Class RamJournalRM.JournalFile

  • All Implemented Interfaces:
    Disposable, AutoCloseable
    Enclosing class:
    RamJournalRM

    protected class RamJournalRM.JournalFile
    extends AbstractJournalRM.JournalFile
    A JournalFile is created for each RAM buffer used to store the journal contents. It is created in an initial "append" mode, it then transitions to a "full" mode, and once enough of its storage has been released it transitions to an "evacuating" mode, which (once evacuated) becomes "garbage" and (upon deletion) is "discarded".
    • Field Detail

      • m_bufWrite

        protected volatile WriteBuffer m_bufWrite
        The buffer that stores the file contents.
      • m_bufRead

        protected volatile ReadBuffer m_bufRead
        The buffer that accesses the file contents.
    • Constructor Detail

      • JournalFile

        public JournalFile​(int nFile)
        Construct a Journal File.
        Parameters:
        nFile - the file number in the range 0-511 (inclusive)
    • Method Detail

      • enqueue

        public long enqueue​(Binary bin)
        Enqueue a Binary value to be written to this file, returning a ticket, or return 0L if this file is full and the append has to occur to a new file.
        Specified by:
        enqueue in class AbstractJournalRM.JournalFile
        Parameters:
        bin - the value to append to the journal file
        Returns:
        a ticket if the Binary has successfully been enqueued, or 0L if the file is full
      • dispose

        public void dispose()
        Invoked when all resources owned by the implementer can safely be released.

        Once disposed of the object should no longer be considered to be usable.

        Note the Disposable interface is compatible with try-with-resources which will automatically invoke this method.

        Specified by:
        dispose in interface Disposable
        Specified by:
        dispose in class AbstractJournalRM.JournalFile
      • notifyWriteCompleted

        public void notifyWriteCompleted()
        Called by the CollectorDaemon the first time that the JournalFile is encountered in its FULL state and its data has all been written.
        Overrides:
        notifyWriteCompleted in class AbstractJournalRM.JournalFile