Package org.rocksdb

Class RocksMutableObject

  • All Implemented Interfaces:
    java.lang.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.

    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      void close()
      Frees the underlying C++ 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
      • Methods inherited from class java.lang.Object

        clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • RocksMutableObject

        protected RocksMutableObject()
      • RocksMutableObject

        protected RocksMutableObject​(long nativeHandle)
    • 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 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
      • 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 disposed, calling any of its functions will lead to undefined behavior.

        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in class AbstractNativeReference
      • disposeInternal

        protected void disposeInternal()
      • disposeInternal

        protected abstract void disposeInternal​(long handle)