mirror of
https://github.com/XRPLF/rippled.git
synced 2026-01-14 11:45:22 +00:00
[Java] Add RocksObject, the base class of all java objects with a c++ pointer.
Summary: Add RocksObject, the base class of all java objects which has a c++ pointer. While the finalizer of a RocksObject will release its c++ resource, it is suggested to call its RocksObject.dispose() to manually release its c++ resource. Existing RocksDB java classes are now extending RocksObject. Test Plan: make rocksdbjava make jtest make jdb_bench Reviewers: haobo, dhruba, sdong, ankgup87, rsumbaly, swapnilghike, zzbennett Reviewed By: haobo CC: leveldb Differential Revision: https://reviews.facebook.net/D18411
This commit is contained in:
@@ -218,7 +218,7 @@ public class RocksDBSample {
|
||||
|
||||
System.out.println("iterator seek test passed.");
|
||||
|
||||
iterator.close();
|
||||
iterator.dispose();
|
||||
System.out.println("iterator tests passed.");
|
||||
|
||||
iterator = db.newIterator();
|
||||
@@ -226,7 +226,7 @@ public class RocksDBSample {
|
||||
for (iterator.seekToLast(); iterator.isValid(); iterator.prev()) {
|
||||
keys.add(iterator.key());
|
||||
}
|
||||
iterator.close();
|
||||
iterator.dispose();
|
||||
|
||||
Map<byte[], byte[]> values = db.multiGet(keys);
|
||||
assert(values.size() == keys.size());
|
||||
@@ -248,5 +248,6 @@ public class RocksDBSample {
|
||||
// be sure to dispose c++ pointers
|
||||
options.dispose();
|
||||
readOptions.dispose();
|
||||
filter.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user