Package com.tangosol.io.journal
Class RamJournalRM.JournalFile
java.lang.Object
com.tangosol.io.journal.AbstractJournalRM.JournalFile
com.tangosol.io.journal.RamJournalRM.JournalFile
- All Implemented Interfaces:
Disposable,AutoCloseable
- Enclosing class:
RamJournalRM
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 Summary
FieldsModifier and TypeFieldDescriptionprotected ReadBufferThe buffer that accesses the file contents.protected WriteBufferThe buffer that stores the file contents.Fields inherited from class com.tangosol.io.journal.AbstractJournalRM.JournalFile
f_journalFileCondition, f_journalFileLock, m_cbReleased, m_cbWritten, m_fNotifiedFull, m_jrnlfileNext, m_lStateOffset, m_nFile, STATE_APPENDING, STATE_CONGESTION, STATE_DISCARDED, STATE_EVACUATING, STATE_FULL, STATE_GARBAGE, STATE_MASK, STATE_RESERVED -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddispose()Invoked when all resources owned by the implementer can safely be released.longEnqueue 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.protected StringFormat the object attributes into a String for inclusion in the String returned from theAbstractJournalRM.JournalFile.toString()method.voidCalled by the CollectorDaemon the first time that the JournalFile is encountered in its FULL state and its data has all been written.read(long lTicket) Read the Binary associated with the specified ticket from the journal file.Methods inherited from class com.tangosol.io.journal.AbstractJournalRM.JournalFile
compareAndSetOffset, compareAndSetState, evacuate, getBytesWritten, getFileId, getNextJournalFile, getOffset, getOffset, getReleased, getState, getState, isAppending, isReserved, release, setNextJournalFile, setReserved, setState, toString, touchMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.oracle.coherence.common.base.Disposable
close
-
Field Details
-
m_bufWrite
The buffer that stores the file contents. -
m_bufRead
The buffer that accesses the file contents.
-
-
Constructor Details
-
JournalFile
public JournalFile(int nFile) Construct a Journal File.- Parameters:
nFile- the file number in the range 0-511 (inclusive)
-
-
Method Details
-
enqueue
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:
enqueuein classAbstractJournalRM.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
-
read
Read the Binary associated with the specified ticket from the journal file.- Specified by:
readin classAbstractJournalRM.JournalFile- Parameters:
lTicket- a ticket previously returned fromAbstractJournalRM.JournalFile.enqueue(com.tangosol.util.Binary)- Returns:
- the Binary value that is associated with the ticket
-
getDescription
Format the object attributes into a String for inclusion in the String returned from theAbstractJournalRM.JournalFile.toString()method.- Overrides:
getDescriptionin classAbstractJournalRM.JournalFile- Returns:
- a comma-delimited String listing the attributes of this object in the form "attribute=value"
-
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:
disposein interfaceDisposable- Specified by:
disposein classAbstractJournalRM.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:
notifyWriteCompletedin classAbstractJournalRM.JournalFile
-