Class StateMgrBase

  • All Implemented Interfaces:
    org.apache.jena.atlas.lib.Closeable, org.apache.jena.atlas.lib.Sync
    Direct Known Subclasses:
    StateMgrData

    public abstract class StateMgrBase
    extends java.lang.Object
    implements org.apache.jena.atlas.lib.Sync, org.apache.jena.atlas.lib.Closeable
    Helper class for the manage the persistent state of a transactional. The persistent state is assumed to be a fixed size, or at least of known maximum size. May not be suitable for all transactional component implementations.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()  
      BufferChannel getBufferChannel()
      Low level control - for example, used for cloning setup.
      java.nio.ByteBuffer getState()
      Return the serialized state using the internal ByteBuffer Typically called by "prepare" for the bytes to write to the journal.
      void readState()
      The read process : get all bytes on disk, deserialize
      void setState​(java.nio.ByteBuffer buff)
      Set the in-memory state from a ByteBuffer, for example, from journal recovery.
      void sync()  
      void writeState()
      The write process : serialize, write, sync, After this, the bytes definitely are on disk, not in some OS cache
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • getBufferChannel

        public BufferChannel getBufferChannel()
        Low level control - for example, used for cloning setup. Use with care.
      • getState

        public java.nio.ByteBuffer getState()
        Return the serialized state using the internal ByteBuffer Typically called by "prepare" for the bytes to write to the journal. Calls serialize(java.nio.ByteBuffer). This method does not perform an external I/O.
      • setState

        public void setState​(java.nio.ByteBuffer buff)
        Set the in-memory state from a ByteBuffer, for example, from journal recovery. This method does not perform an external I/O. Call "writeState" to put the n-memory state as the disk state.
      • writeState

        public void writeState()
        The write process : serialize, write, sync, After this, the bytes definitely are on disk, not in some OS cache
      • readState

        public void readState()
        The read process : get all bytes on disk, deserialize
      • sync

        public void sync()
        Specified by:
        sync in interface org.apache.jena.atlas.lib.Sync
      • close

        public void close()
        Specified by:
        close in interface org.apache.jena.atlas.lib.Closeable