|
Oracle® Coherence Java API Reference Release 12.1.2.0.3 E26043-02 |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object
com.tangosol.io.journal.AbstractJournalRM.JournalFile
protected abstract class AbstractJournalRM.JournalFile
A JournalFile object is created for each file used to store the journal contents. It is created in an initial "append" mode -- which may be interrupted from time to time by a "congested" mode if writes are falling too far behind, 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 | |
---|---|
protected java.util.concurrent.atomic.AtomicLong |
m_cbReleased Amount of data that has been released. |
protected java.util.concurrent.atomic.AtomicLong |
m_cbWritten Amount of data that has been written. |
protected boolean |
m_fNotifiedFull Set to true when the JournalFile is notified that it is full and its contents have been fully written. |
protected AbstractJournalRM.JournalFile |
m_jrnlfileNext The JournalFile that "comes after" this JournalFile in the journal. |
protected java.util.concurrent.atomic.AtomicLong |
m_lStateOffset Current state of the JournalFile and the appending offset within the file. |
protected int |
m_nFile The file index. |
static long |
STATE_APPENDING State: File is being appended to. |
static long |
STATE_CONGESTION State: File is appending, but there is congestion forcing a wait by all appending threads. |
static long |
STATE_DISCARDED State: File has been discarded. |
static long |
STATE_EVACUATING State: Remaining entries in the file are being evacuated. |
static long |
STATE_FULL State: File is full and appends are no longer occurring. |
static long |
STATE_GARBAGE State: File is garbage and can safely be discarded. |
static long |
STATE_MASK The bits of the m_lStateOffset that are used for the current state of the file (one of the STATE_* constants). |
static long |
STATE_RESERVED State: File is reserved by the CollectorDaemon. |
Constructor Summary | |
---|---|
AbstractJournalRM.JournalFile(int nFile) Construct a Journal File. |
Method Summary | |
---|---|
protected boolean |
compareAndSetOffset(long lPrevValue, long lOffset) Specify the new offset value of this JournalFile. |
protected boolean |
compareAndSetState(long lPrevValue, long lState) Specify the current state of this JournalFile unless the state is STATE_RESERVED as it is a special case and should be set via setReserved(boolean) . |
abstract void |
dispose() |
abstract 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. |
void |
evacuate() Called by the CollectorDaemon to evacuate all remaining data from the JournalFile. |
long |
getBytesWritten() Determine the number of bytes written. |
protected java.lang.String |
getDescription() Format the object attributes into a String for inclusion in the String returned from the toString() method. |
int |
getFileId() Determine the file id (0-511) for this JournalFile. |
AbstractJournalRM.JournalFile |
getNextJournalFile() Determine the JournalFile for the file in the journal that follows the file represented by this JournalFile. |
long |
getOffset() Determine the current append offset (or length) of this JournalFile. |
protected long |
getOffset(long lStateOffset) Determine the current append offset (or length) from the provided long. |
long |
getReleased() Determine the number of bytes that have been released from this JournalFile. |
long |
getState() Determine the current state of this JournalFile. |
protected long |
getState(long lState) Determine the state of the provided (potentially) unmasked lState . |
boolean |
isAppending() Return whether the JournalFile can be appended to. |
boolean |
isReserved() Return whether the JournalFile has been reserved thus can not be used by clients. |
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. |
abstract Binary |
read(long lTicket) Read the Binary associated with the specified ticket from the journal file. |
void |
release(int cbValue) Release the specified number of bytes from this journal file. |
void |
setNextJournalFile(AbstractJournalRM.JournalFile jrnlfileNext) Once this file has been filled, it gets a reference to the file that follows it. |
protected void |
setReserved(boolean fReserved) Specify whether the current JournalFile is reserved. |
protected void |
setState(long lState) Specify the current state of this JournalFile. |
java.lang.String |
toString() |
void |
touch() This method is called periodically by the collector daemon to indicate that the file is still being used. |
Field Detail |
---|
public static final long STATE_APPENDING
public static final long STATE_CONGESTION
public static final long STATE_FULL
public static final long STATE_EVACUATING
public static final long STATE_GARBAGE
public static final long STATE_DISCARDED
public static final long STATE_RESERVED
public static final long STATE_MASK
m_lStateOffset
that are used for the current state of the file (one of the STATE_* constants).
protected final int m_nFile
protected final java.util.concurrent.atomic.AtomicLong m_lStateOffset
protected final java.util.concurrent.atomic.AtomicLong m_cbWritten
protected final java.util.concurrent.atomic.AtomicLong m_cbReleased
protected volatile AbstractJournalRM.JournalFile m_jrnlfileNext
protected boolean m_fNotifiedFull
Constructor Detail |
---|
public AbstractJournalRM.JournalFile(int nFile)
nFile
- the file number in the range 0-510 (inclusive)Method Detail |
---|
public abstract long enqueue(Binary bin)
bin
- the value to append to the journal filepublic abstract Binary read(long lTicket)
lTicket
- a ticket previously returned from enqueue(com.tangosol.util.Binary)
public void release(int cbValue)
cbValue
- the number of bytes that are being releasedpublic int getFileId()
public long getState()
public long getOffset()
public long getBytesWritten()
public long getReleased()
public boolean isAppending()
public boolean isReserved()
public void touch()
public AbstractJournalRM.JournalFile getNextJournalFile()
public void setNextJournalFile(AbstractJournalRM.JournalFile jrnlfileNext)
jrnlfileNext
- the next file in the journalprotected java.lang.String getDescription()
toString()
method.public void notifyWriteCompleted()
public void evacuate()
protected void setReserved(boolean fReserved)
fReserved
- whether the JournalFile is reservedpublic abstract void dispose()
dispose
in interface com.oracle.common.base.Disposable
public java.lang.String toString()
protected long getState(long lState)
lState
.lState
- the journal file stateprotected void setState(long lState)
lState
- one of the STATE_* constantsprotected boolean compareAndSetState(long lPrevValue, long lState)
STATE_RESERVED
as it is a special case and should be set via setReserved(boolean)
.lPrevValue
- the expected state valuelState
- one of the STATE_* constants, except STATE_RESERVEDprotected boolean compareAndSetOffset(long lPrevValue, long lOffset)
lPrevValue
- the expected state valuelOffset
- the new offset valueprotected long getOffset(long lStateOffset)
lStateOffset
- the long value holding both the state and offset
|
Oracle® Coherence Java API Reference Release 12.1.2.0.3 E26043-02 |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |