|
Oracle® Coherence Java API Reference Release 3.7.1.0 E22843-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. |
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 AbstractJournalRM.JournalFile[] |
m_ajournalfile Registry of JournalFile objects indexed by file id. |
protected long |
m_cbMaxFile Maximum size for any of the journal files. |
protected int |
m_cbMaxValue Configurable maximum value size. |
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_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 double |
m_dflLoadFactorGC The percentage (as a double in the range 0.01 to 0.99) at which a file is eligible for garbage collection. |
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 XmlElement |
m_xmlConfig The configuration used by this instance. |
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. |
static double |
MAX_COLLECT_PCT Maximum collection factor (0.99, i.e. files that are still almost full). |
static double |
MIN_COLLECT_PCT Minimum collection factor (0.01, i.e. files that are only 1% utilized). |
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) Construct an AbstractJournalRM . |
Method Summary | |
---|---|
protected void |
applyConfig(java.lang.String sName, XmlElement xmlConfig) Parse the XML configuration for the specified setting name, and configure the Journal Resource Manager accordingly. |
protected void |
checkInitializing() Verify that the AbstractJournalRM is still initializing. |
void |
close() Deprecated. use the Disposable interface |
void |
configure(XmlElement xml) Configure the controllable service. |
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. |
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). |
XmlElement |
getConfig() Determine the current configuration of the object. |
java.lang.ClassLoader |
getContextClassLoader() Retrieve the context ClassLoader for this object. |
protected abstract double |
getDefaultCollectorLoadFactor() Determine the default percentage at which a file is eligible for garbage collection. |
protected abstract long |
getDefaultMaxFileSize() Determine the default maximum file size for this Journal Resource Manager. |
protected abstract int |
getDefaultMaxValueSize() Determine the default maximum value size for this Journal Resource Manager. |
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 |
getFileCount() Determine the number of Journal files used by this Journal. |
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. |
int |
getMaxValueSize() Determine the maximum allowable size, in bytes, of a Binary value. |
protected long |
getMinCollectorSleepMillis() Determine the minimum sleep cycle between collections. |
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 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 |
registerJournal(AbstractJournalRM.JournalImpl journal) Register a Journal that uses this Journal Resource Manager. |
protected void |
registerMBean() Register an MBean for this JournalRM. |
void |
setCollectorLoadFactor(double dflFactor) Configure the use-percentage of file below which it becomes eligible for garbage collection. |
void |
setConfig(XmlElement xml) Specify the configuration for the object. |
void |
setContextClassLoader(java.lang.ClassLoader loader) Specify the context ClassLoader for this object. |
abstract void |
setMaxFileSize(long cb) Configure the maximum size of the underlying journal files. |
abstract void |
setMaxValueSize(int cb) Specify the maximum size, in bytes, of Binary values to store. |
protected void |
setState(int nState) Modify the current state of the AbstractJournalRM. |
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, 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
public static final double MIN_COLLECT_PCT
public static final double MAX_COLLECT_PCT
protected int m_nState
protected XmlElement m_xmlConfig
protected java.lang.ClassLoader m_loader
protected long m_cbMaxFile
protected int m_cbMaxValue
protected double m_dflLoadFactorGC
protected double m_dflHighestLoadFactor
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
.
cluster
- the Cluster
for which the AbstractJournalRM
is storing dataMethod Detail |
---|
public void configure(XmlElement xml)
This method can only be called before the controllable service is started.
The Journal Resource Manager supports the following configuration options:
configure
in interface Controllable
xml
- an XmlElement carrying configuration information specific to the Controllable 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 XmlElement getConfig()
getConfig
in interface XmlConfigurable
public void setConfig(XmlElement xml)
setConfig
in interface XmlConfigurable
xml
- the XML configuration for the objectpublic void dispose()
public void close()
public int getMaxJournalFilesNumber()
getMaxJournalFilesNumber
in interface JournalMBean
public int getBinaryStoreCount()
getBinaryStoreCount
in interface JournalMBean
public int getMaxValueSize()
getMaxValueSize
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 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 getHighestLoadFactor()
getHighestLoadFactor
in interface JournalMBean
public 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 abstract void setMaxValueSize(int cb)
Note: This value can be modified while the ResourceManager is running.
cb
- the maximum allowable size for a Binary value, or zero to specify no configured maximum for the value sizepublic abstract void setMaxFileSize(long cb)
Note: This value can only be set before the ResourceManager is started.
cb
- the maximum size, in bytes, for journal filespublic void setCollectorLoadFactor(double dflFactor)
MIN_COLLECT_PCT
and a maximum defined by MAX_COLLECT_PCT
. Setting the value higher means that disk space will be collected more aggressively, but the cost of collection will be significantly higher, while setting the value lower will use more disk space.
Note: This value can only be set before the ResourceManager is started.
dflFactor
- the garbage collector factor in the range 0.01 to 0.99protected int getState()
protected void setState(int nState)
nState
- one of the STATE_* constantsprotected void checkInitializing()
protected void applyConfig(java.lang.String sName, XmlElement xmlConfig)
sName
- the name of the XML settingxmlConfig
- the XML element containing the settingprotected void startThreads()
protected void stopThreads()
protected static java.lang.String getStateDescription(int nState)
nState
- a state identifierprotected java.lang.String getDescription()
toString()
method.protected int getMaxJournalFiles()
protected abstract long getDefaultMaxFileSize()
protected abstract int getDefaultMaxValueSize()
protected abstract double getDefaultCollectorLoadFactor()
protected long getMinCollectorSleepMillis()
protected long getMaxCollectorSleepMillis()
protected boolean isDedupEnabled()
protected boolean isSingleEvacuation()
protected 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 valuepublic Cluster getCluster()
Cluster
for which the AbstractJournalRM
is storing data.Cluster
|
Oracle® Coherence Java API Reference Release 3.7.1.0 E22843-01 |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |