public abstract class AbstractNativeReference extends Object implements AutoCloseable
rocksdb object.
AbstractNativeReference has the dispose()
method, which frees its associated C++ object.
This function should be called manually, however, if required it will be
called automatically during the regular Java GC process via
finalize().
Note - Java can only see the long member variable (which is the C++ pointer value to the native object), as such it does not know the real size of the object and therefore may assign a low GC priority for it; So it is strongly suggested that you manually dispose of objects when you are finished with them.
| Constructor and Description |
|---|
AbstractNativeReference() |
| Modifier and Type | Method and Description |
|---|---|
abstract void |
close()
Frees the underlying C++ object
It is strong recommended that the developer calls this after they
have finished using the object.
|
void |
dispose()
Deprecated.
Instead use
close() |
protected void |
finalize()
Deprecated.
You should not rely on GC of Rocks objects, and instead should
either call
close() manually or make
use of some sort of ARM (Automatic Resource Management) such as
Java 7's try-with-resources
statement |
protected abstract boolean |
isOwningHandle()
Returns true if we are responsible for freeing the underlying C++ object
|
protected abstract boolean isOwningHandle()
dispose()public abstract void close()
It is strong recommended that the developer calls this after they have finished using the object.
Note, that once an instance of AbstractNativeReference has been
disposed, calling any of its functions will lead to undefined
behavior.
close in interface AutoCloseable@Deprecated public final void dispose()
close()@Deprecated protected void finalize() throws Throwable
close() manually or make
use of some sort of ARM (Automatic Resource Management) such as
Java 7's try-with-resources
statementdispose() to free
any underlying C++ object reference which has not yet been manually
released.Copyright © 2021. All rights reserved.