Package org.rocksdb
Class RocksMutableObject
java.lang.Object
org.rocksdb.AbstractNativeReference
org.rocksdb.RocksMutableObject
- All Implemented Interfaces:
AutoCloseable
- Direct Known Subclasses:
AbstractSlice
RocksMutableObject is an implementation of
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.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal voidclose()Frees the underlying C++ objectprotected voidprotected abstract voiddisposeInternal(long handle) protected longGets the value of the C++ pointer pointing to the underlying native C++ objectprotected booleanReturns true if we are responsible for freeing the underlying C++ objectvoidresetNativeHandle(long newNativeHandle, boolean owningNativeHandle) Closes the existing handle, and changes the handle to the new handlevoidsetNativeHandle(long nativeHandle, boolean owningNativeHandle) Sets the handle (C++ pointer) of the underlying C++ native object
-
Constructor Details
-
RocksMutableObject
protected RocksMutableObject() -
RocksMutableObject
protected RocksMutableObject(long nativeHandle)
-
-
Method Details
-
resetNativeHandle
public void resetNativeHandle(long newNativeHandle, boolean owningNativeHandle) Closes the existing handle, and changes the handle to the new handle- Parameters:
newNativeHandle- The C++ pointer to the new native objectowningNativeHandle- true if we own the new native object
-
setNativeHandle
public void setNativeHandle(long nativeHandle, boolean owningNativeHandle) Sets the handle (C++ pointer) of the underlying C++ native object- Parameters:
nativeHandle- The C++ pointer to the native objectowningNativeHandle- true if we own the native object
-
isOwningHandle
protected boolean isOwningHandle()Description copied from class:AbstractNativeReferenceReturns true if we are responsible for freeing the underlying C++ object- Specified by:
isOwningHandlein classAbstractNativeReference- Returns:
- true if we are responsible to free the C++ object
-
getNativeHandle
protected long getNativeHandle()Gets the value of the C++ pointer pointing to the underlying native C++ object- Returns:
- the pointer value for the native object
-
close
public final void close()Description copied from class:AbstractNativeReferenceFrees the underlying C++ objectIt is strong recommended that the developer calls this after they have finished using the object.
Note, that once an instance of
AbstractNativeReferencehas been closed, calling any of its functions will lead to undefined behavior.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein classAbstractNativeReference
-
disposeInternal
protected void disposeInternal() -
disposeInternal
protected abstract void disposeInternal(long handle)
-