|
Oracle® Fusion Middleware Java API Reference for Oracle Coherence 12c (12.1.3.0.0) E47890-01 |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object
com.tangosol.io.journal.AbstractJournalRM
public abstract class AbstractJournalRM
The AbstractJournalRM represents a Journal Resource Manager that manages storage for journaled data, and acts as a shared resource for any number of journals that share a common configuration. This implementation is intended to support both file-based and memory-based implementations.
The limits on the journal are as follows:
Nested Class Summary | |
---|---|
protected class |
AbstractJournalRM.CollectorDaemon The CollectorDaemon evaluates the JournalFile objects to see which ones should be evacuated, it evacuates those that should be, and it deletes those that have been successfully evacuated. |
static class |
AbstractJournalRM.DefaultDependencies The DefaultDependencies class provides a default implementation of Dependencies. |
protected static interface |
AbstractJournalRM.Dependencies The Dependencies interface provides AbstractJournalRM with its external dependencies. |
protected class |
AbstractJournalRM.JournalFile A JournalFile object is created for each file used to store the journal contents. |
protected class |
AbstractJournalRM.JournalImpl A Journal implementation managed by this Journal Resource Manager. |
Field Summary | |
---|---|
protected static boolean |
DEDUPE_ENABLED Whether de-duping (interning) the byte arrays held by the BinaryRadixTree should be requested. |
protected AbstractJournalRM.JournalFile[] |
m_ajournalfile Registry of JournalFile objects indexed by file id. |
protected int |
m_cJournalFiles The number of JournalFiles that currently exist. |
protected AbstractJournalRM.CollectorDaemon |
m_daemonCollector The "garbage collector" thread that determines when journal files are ripe to be evacuated and deleted. |
protected double |
m_dblFileSizeFactor The size of the file as a ratio to the largest possible file size. |
protected AbstractJournalRM.Dependencies |
m_dependencies The configuration used by this instance. |
protected double |
m_dflHighestLoadFactor The highest percentage (as a double in the range 0.00 to 1.00) of the configured capacity that this journal has reached. |
protected AbstractJournalRM.JournalFile |
m_jrnlfile The current JournalFile. |
protected java.lang.ClassLoader |
m_loader The ClassLoader supplied to this Controllable instance. |
protected int |
m_nState The current state of the Resource Manager; one of the STATE_* constants. |
protected java.util.Set |
m_setJournals Registry of JournalImpl objects. |
protected static long |
MASK_COMPACT_FLAG The 64-bit bitmask for the compact flag. |
protected static long |
MASK_COMPACT_LENGTH The 64-bit bitmask for the compact length. |
protected static int |
SHIFT_COMPACT_FLAG The location of the compact flag within the ticket. |
protected static int |
SHIFT_COMPACT_LENGTH The location of the compact length within the ticket. |
protected static int |
STATE_CONFIGURED State: Configured (ready to be started). |
protected static int |
STATE_INITIAL State: Initial (unconfigured). |
protected static int |
STATE_RUNNING State: Running (able to be shut down or stopped). |
protected static int |
STATE_STOPPED State: Stopped. |
protected static int |
STATE_STOPPING State: Stopping. |
Constructor Summary | |
---|---|
protected |
AbstractJournalRM(Cluster cluster, AbstractJournalRM.Dependencies deps) Construct an AbstractJournalRM . |
Method Summary | |
---|---|
protected double |
calculateCurrentLoadFactor() Calculate current load factor for compaction (GC). |
abstract AbstractJournalRM.DefaultDependencies |
cloneDependencies(AbstractJournalRM.Dependencies deps) Clone the Dependencies object. |
void |
close() Deprecated. use the Disposable interface |
void |
compact(boolean fRegular) Execute either a regular or exhaustive compaction on the journal based on the provided parameter. |
void |
configure(XmlElement xml) Configure the dependencies object given the xml configuration. |
JournalBinaryStore |
createBinaryStore() Create a new BinaryStore that will journal its information using this Journal Resource Manager. |
Journal |
createJournal(Journal.JournalConsumer consumer) Create a new Journal that exposes the storage capabilities of this Journal Resource Manager. |
void |
destroyBinaryStore(BinaryStore store) Lifecycle method: Destroy a BinaryStore previously created by this manager. |
void |
dispose() |
protected long |
encodeTicket(ByteSequence bin) Encode a Binary into a "ticket". |
protected abstract long |
encodeTicket(int nFile, long of, int cb) Encode a file number, offset and length into a "ticket". |
protected AbstractJournalRM.JournalFile |
ensureCurrentJournalFile() Obtain the current JournalFile that is being appended to, creating a new one if necessary. |
protected Binary |
extractBinary(long lTicket) Extract a Binary from the passed ticket. |
protected abstract int |
extractFileId(long lTicket) Extract a file index (a file ID) from the passed ticket. |
protected abstract int |
extractLength(long lTicket) Extract a file offset from the passed ticket. |
protected abstract long |
extractOffset(long lTicket) Extract a file offset from the passed ticket. |
int |
getBinaryStoreCount() Determine the number of active BinaryStore objects that are using this Journal. |
protected Cluster |
getCluster() Returns the Cluster for which the AbstractJournalRM is storing data. |
protected AbstractJournalRM.CollectorDaemon |
getCollectorDaemon() Obtain the CollectorDaemon instance. |
double |
getCollectorLoadFactor() Determine the load factor threshold at which files become eligible for garbage collection (compaction). |
protected long |
getCollectorTimeout() Return the number of milliseconds the Collector can be unresponsive prior to considering the Collector timed out. |
int |
getCompactionCount() Determine the number of compactions (garbage collections) performed by this journal. |
java.lang.ClassLoader |
getContextClassLoader() Retrieve the context ClassLoader for this object. |
double |
getCurrentCollectorLoadFactor() Determine the current load factor threshold for the journal. |
AbstractJournalRM.Dependencies |
getDependencies() Return the Dependencies object. |
protected java.lang.String |
getDescription() Format the object attributes into a String for inclusion in the String returned from the toString() method. |
protected abstract long |
getEvacuationMask() Obtain the bit mask that is used to identify tickets that need to be evacuated for a particular file id. |
int |
getExhaustiveCompactionCount() Determine the total number of exhaustive compactions performed by the collector. |
long |
getExhaustiveCompactionTime() Return the amount time spent performing exhaustive compaction. |
int |
getFileCount() Determine the number of Journal files used by this Journal. |
protected Guardian |
getGuardian() Return the Guardian associated with the Cluster or null if absent. |
double |
getHighestLoadFactor() Determine the high-water mark load factor for the entire journal. |
protected AbstractJournalRM.JournalFile |
getJournalFile(int nFileId) Obtain a JournalFile by its ID. |
protected long |
getMaxCollectorSleepMillis() Determine the maximum sleep cycle between collections. |
long |
getMaxFileSize() Determine the maximum allowable size, in bytes, of each individual file used to hold Journal data. |
protected int |
getMaxJournalFiles() Determine the maximum number of journal files. |
int |
getMaxJournalFilesNumber() Determine the maximum number of Journal files. |
protected long |
getMaxJournalSize() Return the total amount of memory, in bytes, that can be allocated for Journal storage. |
int |
getMaxValueSize() Determine the maximum allowable size, in bytes, of a Binary value. |
protected long |
getMinCollectorSleepMillis() Determine the minimum sleep cycle between collections. |
protected abstract java.lang.String |
getName() Returns the name value to be used in MBean Objectname key "name". |
protected int |
getState() Determine the current state of the AbstractJournalRM. |
protected static java.lang.String |
getStateDescription(int nState) Format the passed state identifier into a human-readable string. |
protected AbstractJournalRM.JournalFile |
getSurvivorFile() Return a AbstractJournalRM.JournalFile based on the context of the calling thread or null if it is determined that an exhaustive evacuation will not reclaim sufficient memory. |
protected java.lang.String |
getTicketDescription(long lTicket) Format the information encoded in a ticket into a debug string. |
long |
getTotalDataSize() Determine the amount of data currently stored by this Journal. |
long |
getTotalFileSize() Determine the number of bytes in the Journal files for this Journal. |
protected AbstractJournalRM.CollectorDaemon |
instantiateCollectorDaemon() Factory: Instantiate a CollectorDaemon. |
protected AbstractJournalRM.JournalImpl |
instantiateJournal() Factory: Instantiate a JournalImpl object. |
protected abstract AbstractJournalRM.JournalFile |
instantiateJournalFile(int nFile) Factory: Instantiate a JournalFile or subclass thereof. |
protected boolean |
isCompact(long lTicket) Determine if the ticket is in the compact form. |
protected boolean |
isDedupEnabled() Determine if this journal resource manager should de-dup the keys that its JournalBinaryStore instances are managing. |
boolean |
isRunning() Determine whether or not the controllable service is running. |
protected boolean |
isSingleEvacuation() Determine if this journal resource manager should only evacuate one single JournalFile (at the most) per collection cycle. |
protected java.util.Iterator |
iterateJournalFiles() Iterate all of the JournalFile objects. |
protected java.util.Iterator |
iterateJournals() Iterate through the Journal instances that have been created by this Journal Resource Manager but have not been disposed of yet. |
protected void |
onDependencies(AbstractJournalRM.Dependencies deps) Process the Dependencies after they have been injected into this object. |
protected void |
registerJournal(AbstractJournalRM.JournalImpl journal) Register a Journal that uses this Journal Resource Manager. |
protected void |
registerMBean() Register an MBean for this JournalRM. |
void |
resetStatistics() Reset the journal statistics. |
void |
setContextClassLoader(java.lang.ClassLoader loader) Specify the context ClassLoader for this object. |
protected void |
setState(int nState) Modify the current state of the AbstractJournalRM. |
protected boolean |
shouldNotifyCollector() Check if the Collector daemon needs to be notified to come out of sleep |
void |
shutdown() Stop the controllable service. |
void |
start() Start the controllable service. |
protected void |
startThreads() Create and start the various threads used by this Journal Resource Manager. |
void |
stop() Hard-stop the controllable service. |
protected void |
stopThreads() Stop the various threads used by this Journal Resource Manager. |
java.lang.String |
toString() |
protected void |
unregisterJournal(AbstractJournalRM.JournalImpl journal) Register a Journal that uses this Journal Resource Manager. |
protected void |
unregisterMBean() Unregister an MBean for this JournalRM. |
Methods inherited from interface com.tangosol.io.journal.JournalMBean |
---|
getBacklogCount, getBacklogSize, getBufferSize, getHighFileCount, getMaxBacklogSize, getMaxPoolSize, getMaxTotalRam, getPoolSize, isNioRam |
Field Detail |
---|
protected static final int STATE_INITIAL
protected static final int STATE_CONFIGURED
protected static final int STATE_RUNNING
protected static final int STATE_STOPPING
protected static final int STATE_STOPPED
protected static final int SHIFT_COMPACT_FLAG
protected static final long MASK_COMPACT_FLAG
The compact flag is the bit that signifies whether the ticket contains the actual value encoded into the long, versus a "proper" journal file ticket.
protected static final int SHIFT_COMPACT_LENGTH
protected static final long MASK_COMPACT_LENGTH
protected static final boolean DEDUPE_ENABLED
protected int m_nState
protected AbstractJournalRM.Dependencies m_dependencies
protected java.lang.ClassLoader m_loader
protected double m_dflHighestLoadFactor
protected double m_dblFileSizeFactor
protected final java.util.Set m_setJournals
protected final AbstractJournalRM.JournalFile[] m_ajournalfile
protected volatile int m_cJournalFiles
protected volatile AbstractJournalRM.JournalFile m_jrnlfile
protected AbstractJournalRM.CollectorDaemon m_daemonCollector
Constructor Detail |
---|
protected AbstractJournalRM(Cluster cluster, AbstractJournalRM.Dependencies deps)
AbstractJournalRM
.
cluster
- the Cluster
for which the AbstractJournalRM
is storing datadeps
- the Dependencies objectMethod Detail |
---|
public void configure(XmlElement xml)
configure
in interface Controllable
xml
- the XML configuration for the objectpublic void start()
This method should only be called once per the life cycle of the Controllable service. This method has no affect if the service is already running.
start
in interface Controllable
public boolean isRunning()
isRunning
in interface Controllable
public void shutdown()
Controllable.stop()
method.
This method should only be called once per the life cycle of the controllable service. Calling this method for a service that has already stopped has no effect.
shutdown
in interface Controllable
public void stop()
Controllable.shutdown()
for normal service termination. Calling this method for a service that has already stopped has no effect.stop
in interface Controllable
public java.lang.ClassLoader getContextClassLoader()
getContextClassLoader
in interface ClassLoaderAware
Thread.getContextClassLoader()
public void setContextClassLoader(java.lang.ClassLoader loader)
setContextClassLoader
in interface ClassLoaderAware
loader
- the context ClassLoader for this objectpublic void dispose()
dispose
in interface com.oracle.common.base.Disposable
public void close()
public int getMaxJournalFilesNumber()
getMaxJournalFilesNumber
in interface JournalMBean
public int getBinaryStoreCount()
getBinaryStoreCount
in interface JournalMBean
public int getFileCount()
getFileCount
in interface JournalMBean
public long getTotalDataSize()
getTotalDataSize
in interface JournalMBean
public long getTotalFileSize()
getTotalFileSize
in interface JournalMBean
public int getMaxValueSize()
getMaxValueSize
in interface JournalMBean
public long getMaxFileSize()
getMaxFileSize
in interface JournalMBean
public double getCollectorLoadFactor()
When the portion of released data exceeds (1 - threshold), the file becomes eligible for compaction (garbage collection).
getCollectorLoadFactor
in interface JournalMBean
public double getCurrentCollectorLoadFactor()
getCurrentCollectorLoadFactor
in interface JournalMBean
public double getHighestLoadFactor()
getHighestLoadFactor
in interface JournalMBean
public int getCompactionCount()
getCompactionCount
in interface JournalMBean
public int getExhaustiveCompactionCount()
getExhaustiveCompactionCount
in interface JournalMBean
public long getExhaustiveCompactionTime()
getExhaustiveCompactionTime
in interface JournalMBean
public void resetStatistics()
resetStatistics
in interface JournalMBean
public void compact(boolean fRegular)
An exhaustive compaction is only executed if sufficient memory has been released or sufficient time has elapsed since the previous exhaustive compaction.
compact
in interface JournalMBean
fRegular
- whether the compaction should be regular; false for an exhaustive compactionpublic JournalBinaryStore createBinaryStore()
createBinaryStore
in interface BinaryStoreManager
public void destroyBinaryStore(BinaryStore store)
destroyBinaryStore
in interface BinaryStoreManager
store
- a BinaryStore object previously created by this managerpublic Journal createJournal(Journal.JournalConsumer consumer)
consumer
- the JournalConsumer that will be using the Journalpublic java.lang.String toString()
public AbstractJournalRM.Dependencies getDependencies()
public abstract AbstractJournalRM.DefaultDependencies cloneDependencies(AbstractJournalRM.Dependencies deps)
deps
- the populated Dependencies objectprotected void onDependencies(AbstractJournalRM.Dependencies deps)
deps
- the populated Dependencies objectprotected int getState()
protected void setState(int nState)
nState
- one of the STATE_* constantsprotected void startThreads()
protected void stopThreads()
protected double calculateCurrentLoadFactor()
protected static java.lang.String getStateDescription(int nState)
nState
- a state identifierprotected java.lang.String getDescription()
toString()
method.protected int getMaxJournalFiles()
protected long getMaxJournalSize()
protected long getMinCollectorSleepMillis()
protected long getMaxCollectorSleepMillis()
protected boolean isDedupEnabled()
protected boolean isSingleEvacuation()
protected AbstractJournalRM.JournalFile getSurvivorFile()
AbstractJournalRM.JournalFile
based on the context of the calling thread or null if it is determined that an exhaustive evacuation will not reclaim sufficient memory. This method should only be invoked in a "depleted" state when:
non-appending
When called on the CollectorDaemon thread this method returns a normal JournalFile, with the only exception that it will be in excess to the maximum number of permitted journal files and used exclusively by the CollectorDaemon to perform evacuation in a depleted state.
null
may be returned if it is determined that an exhaustive evacuation will not reclaim sufficient memoryprotected void registerMBean()
protected void unregisterMBean()
protected AbstractJournalRM.JournalImpl instantiateJournal()
protected void registerJournal(AbstractJournalRM.JournalImpl journal)
journal
- an instance of JournalImpl created by this Journal Resource Managerprotected void unregisterJournal(AbstractJournalRM.JournalImpl journal)
journal
- an instance of JournalImpl created by this Journal Resource Managerprotected java.util.Iterator iterateJournals()
protected AbstractJournalRM.JournalFile getJournalFile(int nFileId)
nFileId
- the file id (0-511)protected AbstractJournalRM.JournalFile ensureCurrentJournalFile()
protected java.util.Iterator iterateJournalFiles()
protected abstract AbstractJournalRM.JournalFile instantiateJournalFile(int nFile)
nFile
- the file number in the range 0-511 (inclusive)protected AbstractJournalRM.CollectorDaemon instantiateCollectorDaemon()
protected AbstractJournalRM.CollectorDaemon getCollectorDaemon()
protected boolean isCompact(long lTicket)
lTicket
- a "ticket" that was created by the Journalprotected abstract long getEvacuationMask()
protected abstract int extractFileId(long lTicket)
lTicket
- a "ticket" that was created by the Journalprotected abstract long extractOffset(long lTicket)
lTicket
- a "ticket" that was created by the Journalprotected abstract int extractLength(long lTicket)
lTicket
- a "ticket" that was created by the Journalprotected abstract long encodeTicket(int nFile, long of, int cb)
nFile
- a file number (aka a file index)of
- a value offsetcb
- a value lengthprotected long encodeTicket(ByteSequence bin)
bin
- a ByteSequence with (length() <= 7)protected Binary extractBinary(long lTicket)
lTicket
- a compact "ticket" that was created by the Journalprotected java.lang.String getTicketDescription(long lTicket)
lTicket
- the ticket valueprotected boolean shouldNotifyCollector()
protected Cluster getCluster()
Cluster
for which the AbstractJournalRM
is storing data.Cluster
protected Guardian getGuardian()
Guardian
associated with the Cluster
or null if absent.protected long getCollectorTimeout()
protected abstract java.lang.String getName()
|
Oracle® Fusion Middleware Java API Reference for Oracle Coherence 12c (12.1.3.0.0) E47890-01 |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |