Package com.tangosol.io.journal
Class AbstractJournalRM.CollectorDaemon
- java.lang.Object
-
- com.tangosol.util.Base
-
- com.tangosol.util.Daemon
-
- com.tangosol.io.journal.AbstractJournalRM.CollectorDaemon
-
- Enclosing class:
- AbstractJournalRM
protected class AbstractJournalRM.CollectorDaemon extends Daemon
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.This daemon is not intended to be guarded.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
AbstractJournalRM.CollectorDaemon.CollectionCoordinator
A CollectionCoordinator is responsible for shaping an evacuation as well as managing any reserved files created to ensure the journal continues to operate.protected class
AbstractJournalRM.CollectorDaemon.InvokeGCJournalFile
AAbstractJournalRM.JournalFile
implementation returned when the journal has consumed all known capacity.-
Nested classes/interfaces inherited from class com.tangosol.util.Daemon
Daemon.DaemonWorker
-
Nested classes/interfaces inherited from class com.tangosol.util.Base
Base.LoggingWriter
-
-
Constructor Summary
Constructors Constructor Description CollectorDaemon()
Construct a CollectorDaemon.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
dedupe()
Give the in-memory radix key stores a chance to de-dupe their byte[] values, similar to the concept behind String's intern() method.protected AbstractJournalRM.CollectorDaemon.CollectionCoordinator
getCoordinator()
protected String
getDescription()
Format the Daemon attributes into a String for inclusion in the String returned from theDaemon.toString()
method.protected int
getReservedFileId()
Return the currently reserved file id.protected Daemon.DaemonWorker
instantiateWorker()
Instantiate a DaemonWorker that will be used as a daemon.void
notifyReleased(int cbReleased, int nFileId)
Notifies the collector that aAbstractJournalRM.JournalFile
has had some memory released.void
run()
The daemon's implementation method.protected void
setGuardPolicy(Guardian guardian, long cTimeoutMillis, float flPctRecover)
Set the Guardian and policy to guard this Daemon with.protected Iterator<AbstractJournalRM.JournalFile>
sortedIterator()
Returns a sortedIterator
based on the amount of released memory in eachAbstractJournalRM.JournalFile
.void
stop()
Request the daemon to stop.-
Methods inherited from class com.tangosol.util.Daemon
changeState, configureWorker, ensureThreadGroup, finishStarting, finishStopping, getConfiguredName, getConfiguredPriority, getContext, getGuardRegisterAction, getMaxWaitMillis, getState, getThread, getThreadContextClassLoader, getWorker, guardIfNeeded, heartbeat, heartbeat, isGuarded, isOnWorkerThread, isRunning, isStopping, recover, setConfiguredName, setConfiguredPriority, setContext, setGuardRegisterAction, setThreadContextClassLoader, shutdown, start, terminate, toStateString, toString
-
Methods inherited from class com.tangosol.util.Base
azzert, azzert, azzert, azzertFailed, breakLines, breakLines, capitalize, checkNotEmpty, checkNotNull, checkRange, computeSafeWaitTime, decimalValue, dup, dup, ensureBigDecimal, ensureClassLoader, ensureRuntimeException, ensureRuntimeException, equals, equalsDeep, err, err, err, err, err, escape, formatDateTime, getCallerStackFrame, getCommonMonitor, getCommonMonitor, getCommonMonitor, getContextClassLoader, getContextClassLoader, getDeepMessage, getErr, getLastSafeTimeMillis, getLog, getMaxDecDigits, getMaxHexDigits, getOriginalException, getOut, getProcessRandom, getRandom, getRandomBinary, getRandomBinary, getRandomString, getSafeTimeMillis, getStackFrame, getStackFrames, getStackTrace, getStackTrace, getStackTrace, getThreadFactory, getTimeZone, getUpTimeMillis, hashCode, hexValue, indentString, indentString, isDecimal, isHex, isLogEcho, isOctal, log, log, log, log, log, makeInteger, makeLong, makeThread, mergeArray, mergeBooleanArray, mergeByteArray, mergeCharArray, mergeDoubleArray, mergeFloatArray, mergeIntArray, mergeLongArray, mod, mod, octalValue, out, out, out, out, out, pad, parseBandwidth, parseBandwidth, parseDelimitedString, parseHex, parseHex, parseMemorySize, parseMemorySize, parsePercentage, parseTime, parseTime, parseTimeNanos, parseTimeNanos, printStackTrace, randomize, randomize, randomize, randomize, read, read, read, read, read, read, read, replace, setErr, setLog, setLogEcho, setOut, sleep, toBandwidthString, toBandwidthString, toCharEscape, toCrc, toCrc, toCrc, toCrc, toCrc, toDecString, toDelimitedString, toDelimitedString, toDelimitedString, toDelimitedString, toHex, toHex, toHexDump, toHexEscape, toHexEscape, toHexEscape, toHexEscape, toHexString, toMemorySizeString, toMemorySizeString, toQuotedCharEscape, toQuotedStringEscape, toSqlString, toString, toString, toStringEscape, toUnicodeEscape, trace, trace, trace, trace, trace, trace, trace, trace, trace, truncateString, truncateString, wait
-
-
-
-
Method Detail
-
instantiateWorker
protected Daemon.DaemonWorker instantiateWorker()
Instantiate a DaemonWorker that will be used as a daemon.- Overrides:
instantiateWorker
in classDaemon
- Returns:
- a new instance of DaemonWorker or a sub-class thereof
-
stop
public void stop()
Request the daemon to stop. This method will only have an effect if the daemon sub-class respects the value returned fromDaemon.isStopping()
.
-
run
public void run()
The daemon's implementation method. Override this method to implement a daemon.An example implementation is:
while (!isStopping()) { // do some processing // ... synchronized (this) { // wait for notification of more work wait(); } }
-
setGuardPolicy
protected void setGuardPolicy(Guardian guardian, long cTimeoutMillis, float flPctRecover)
Set the Guardian and policy to guard this Daemon with. The Daemon is registered with the specified Guardian each time the Daemon is started, and is released each time the Daemon is stopped.- Overrides:
setGuardPolicy
in classDaemon
- Parameters:
guardian
- the Guardian that will be guarding this DaemoncTimeoutMillis
- the timeout in ms for this Daemon, or 0 for the service guardian timeoutflPctRecover
- the recovery percentage for this Daemon
-
sortedIterator
protected Iterator<AbstractJournalRM.JournalFile> sortedIterator()
Returns a sortedIterator
based on the amount of released memory in eachAbstractJournalRM.JournalFile
.- Returns:
- a sorted iterator ascending based on released memory
-
getDescription
protected String getDescription()
Format the Daemon attributes into a String for inclusion in the String returned from theDaemon.toString()
method.- Overrides:
getDescription
in classDaemon
- Returns:
- a String listing the attributes of the Daemon
-
dedupe
protected void dedupe()
Give the in-memory radix key stores a chance to de-dupe their byte[] values, similar to the concept behind String's intern() method.
-
notifyReleased
public void notifyReleased(int cbReleased, int nFileId)
Notifies the collector that aAbstractJournalRM.JournalFile
has had some memory released.- Parameters:
cbReleased
- the number of bytes releasednFileId
- theAbstractJournalRM.JournalFile
's file id
-
getReservedFileId
protected int getReservedFileId()
Return the currently reserved file id.- Returns:
- the currently reserved file id
-
getCoordinator
protected AbstractJournalRM.CollectorDaemon.CollectionCoordinator getCoordinator()
- Returns:
- a CollectionCoordinator
-
-