Package org.rocksdb

Class RocksMutableObject

All Implemented Interfaces:
AutoCloseable
Direct Known Subclasses:
AbstractSlice

public abstract class RocksMutableObject extends AbstractNativeReference
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
    Modifier
    Constructor
    Description
    protected
     
    protected
    RocksMutableObject(long nativeHandle)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    final void
    Frees the underlying C++ object
    protected void
     
    protected abstract void
    disposeInternal(long handle)
     
    protected long
    Gets the value of the C++ pointer pointing to the underlying native C++ object
    protected boolean
    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

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 object
      owningNativeHandle - 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 object
      owningNativeHandle - true if we own the native object
    • isOwningHandle

      protected boolean isOwningHandle()
      Description copied from class: AbstractNativeReference
      Returns true if we are responsible for freeing the underlying C++ object
      Specified by:
      isOwningHandle in class AbstractNativeReference
      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: AbstractNativeReference
      Frees the underlying C++ object

      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.

      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in class AbstractNativeReference
    • disposeInternal

      protected void disposeInternal()
    • disposeInternal

      protected abstract void disposeInternal(long handle)