diff --git a/java/org/rocksdb/RestoreBackupableDB.java b/java/org/rocksdb/RestoreBackupableDB.java index 8c6dbf531..dbde447a0 100644 --- a/java/org/rocksdb/RestoreBackupableDB.java +++ b/java/org/rocksdb/RestoreBackupableDB.java @@ -68,11 +68,9 @@ public class RestoreBackupableDB extends RocksObject { * Release the memory allocated for the current instance * in the c++ side. */ - @Override public synchronized void dispose() { - if (isInitialized()) { - dispose(nativeHandle_); - nativeHandle_ = 0; - } + @Override public synchronized void disposeInternal() { + assert(isInitialized()); + dispose(nativeHandle_); } private native long newRestoreBackupableDB(long options); diff --git a/java/org/rocksdb/RestoreOptions.java b/java/org/rocksdb/RestoreOptions.java index 0321c3b9c..77a2b99bc 100644 --- a/java/org/rocksdb/RestoreOptions.java +++ b/java/org/rocksdb/RestoreOptions.java @@ -27,11 +27,9 @@ public class RestoreOptions extends RocksObject { * Release the memory allocated for the current instance * in the c++ side. */ - @Override public synchronized void dispose() { - if (isInitialized()) { - dispose(nativeHandle_); - nativeHandle_ = 0; - } + @Override public synchronized void disposeInternal() { + assert(isInitialized()); + dispose(nativeHandle_); } private native long newRestoreOptions(boolean keepLogFiles);