public abstract class RocksMutableObject extends AbstractNativeReference
AbstractNativeReference
whose reference to the underlying native C++ object can change.
The use of RocksMutableObject
should be kept to a minimum, as it
has synchronization overheads and introduces complexity. Instead it is
recommended to use RocksObject
where possible.
Modifier | Constructor and Description |
---|---|
protected |
RocksMutableObject() |
protected |
RocksMutableObject(long nativeHandle) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Frees the underlying C++ object
It is strong recommended that the developer calls this after they
have finished using the object.
|
protected void |
disposeInternal() |
protected abstract void |
disposeInternal(long handle) |
protected long |
getNativeHandle()
Gets the value of the C++ pointer pointing to the underlying
native C++ object
|
protected boolean |
isOwningHandle()
Returns true if we are responsible for freeing the underlying C++ object
|
void |
resetNativeHandle(long newNativeHandle,
boolean owningNativeHandle)
Closes the existing handle, and changes the handle to the new handle
|
void |
setNativeHandle(long nativeHandle,
boolean owningNativeHandle)
Sets the handle (C++ pointer) of the underlying C++ native object
|
protected RocksMutableObject()
protected RocksMutableObject(long nativeHandle)
public void resetNativeHandle(long newNativeHandle, boolean owningNativeHandle)
newNativeHandle
- The C++ pointer to the new native objectowningNativeHandle
- true if we own the new native objectpublic void setNativeHandle(long nativeHandle, boolean owningNativeHandle)
nativeHandle
- The C++ pointer to the native objectowningNativeHandle
- true if we own the native objectprotected boolean isOwningHandle()
AbstractNativeReference
isOwningHandle
in class AbstractNativeReference
protected long getNativeHandle()
public final void close()
AbstractNativeReference
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
closed, calling any of its functions will lead to undefined
behavior.
close
in interface AutoCloseable
close
in class AbstractNativeReference
protected void disposeInternal()
protected abstract void disposeInternal(long handle)
Copyright © 2023. All rights reserved.