Package org.rocksdb
Class RocksMutableObject
- java.lang.Object
-
- org.rocksdb.AbstractNativeReference
-
- org.rocksdb.RocksMutableObject
-
- All Implemented Interfaces:
java.lang.AutoCloseable
- Direct Known Subclasses:
AbstractSlice
public abstract class RocksMutableObject extends AbstractNativeReference
RocksMutableObject is an implementation ofAbstractNativeReferencewhose reference to the underlying native C++ object can change.The use of
RocksMutableObjectshould be kept to a minimum, as it has synchronization overheads and introduces complexity. Instead it is recommended to useRocksObjectwhere possible.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedRocksMutableObject()protectedRocksMutableObject(long nativeHandle)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidclose()Frees the underlying C++ objectprotected voiddisposeInternal()protected abstract voiddisposeInternal(long handle)protected longgetNativeHandle()Gets the value of the C++ pointer pointing to the underlying native C++ objectprotected booleanisOwningHandle()Returns 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-
Methods inherited from class org.rocksdb.AbstractNativeReference
dispose, finalize
-
-
-
-
Method Detail
-
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
- See Also:
AbstractNativeReference.dispose()
-
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 disposed, calling any of its functions will lead to undefined behavior.- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein classAbstractNativeReference
-
disposeInternal
protected void disposeInternal()
-
disposeInternal
protected abstract void disposeInternal(long handle)
-
-