diff --git a/Allay-Server/src/main/java/cn/allay/server/world/storage/rocksdb/RocksDBWorldStorage.java b/Allay-Server/src/main/java/cn/allay/server/world/storage/rocksdb/RocksDBWorldStorage.java index 0f00b4354..c56a608ba 100644 --- a/Allay-Server/src/main/java/cn/allay/server/world/storage/rocksdb/RocksDBWorldStorage.java +++ b/Allay-Server/src/main/java/cn/allay/server/world/storage/rocksdb/RocksDBWorldStorage.java @@ -58,6 +58,7 @@ public RocksDBWorldStorage(Path path, Options options) throws WorldStorageExcept File logFolder = path.resolve("db/log").toFile(); if (!logFolder.exists()) logFolder.mkdirs(); db = RocksDB.open(options, dbFolder.getAbsolutePath()); + options.close(); } catch (RocksDBException e) { throw new WorldStorageException(e); } @@ -110,7 +111,9 @@ public CompletableFuture writeChunk(Chunk chunk) throws WorldStorageExcept } } ); - this.db.write(new WriteOptions(), writeBatch); + try (WriteOptions writeOptions = new WriteOptions()) { + this.db.write(writeOptions, writeBatch); + } return null; } catch (RocksDBException e) { throw new RuntimeException(e);