mirror of
https://github.com/Minestom/Minestom.git
synced 2024-11-07 11:20:09 +01:00
Possible fix a when storage location is closed an re opened
This commit is contained in:
parent
fdcaefaf86
commit
8047a203cb
@ -19,6 +19,8 @@ import java.nio.file.Paths;
|
||||
*/
|
||||
public class FileStorageSystem implements StorageSystem {
|
||||
|
||||
private Options options;
|
||||
|
||||
static {
|
||||
RocksDB.loadLibrary();
|
||||
}
|
||||
@ -32,11 +34,11 @@ public class FileStorageSystem implements StorageSystem {
|
||||
|
||||
@Override
|
||||
public void open(@NotNull String location, @NotNull StorageOptions storageOptions) {
|
||||
Options options = new Options().setCreateIfMissing(true);
|
||||
options = new Options().setCreateIfMissing(true);
|
||||
|
||||
if (storageOptions.hasCompression()) {
|
||||
options.setCompressionType(CompressionType.ZSTD_COMPRESSION);
|
||||
options.setCompressionOptions(new CompressionOptions().setLevel(1));
|
||||
options.setCompressionOptions(new CompressionOptions().setLevel(4));
|
||||
}
|
||||
|
||||
try {
|
||||
@ -78,6 +80,10 @@ public class FileStorageSystem implements StorageSystem {
|
||||
public void close() {
|
||||
try {
|
||||
this.rocksDB.closeE();
|
||||
|
||||
if (options != null)
|
||||
this.options.close();
|
||||
|
||||
} catch (RocksDBException e) {
|
||||
MinecraftServer.getExceptionManager().handleException(e);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user