Package com.tangosol.io
Class AsyncBinaryStore.QueueDaemon
java.lang.Object
com.tangosol.util.Base
com.tangosol.util.Daemon
com.tangosol.io.AsyncBinaryStore.QueueDaemon
- Enclosing class:
AsyncBinaryStore
A daemon that processes queued writes.
-
Nested Class Summary
Nested classes/interfaces inherited from class com.tangosol.util.Daemon
Daemon.DaemonWorkerNested classes/interfaces inherited from class com.tangosol.util.Base
Base.LoggingWriter -
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanisDone()Determine if the daemon thread should continue processing or should shut itself down.protected booleanDetermine whether the daemon is dormant or not.protected voidprocessPending(Binary binKey, Binary binValue) Store the specified value under the specific key in the underlying store, or if the value isAsyncBinaryStore.DELETEDthen erase the value from the underlying store.voidrun()This method is invoked on the daemon thread and performs the daemon processing until the thread stops.voidNotify the daemon that there is work to be done.protected voidsetDormant(boolean fDormant) Specify whether the daemon is dormant or not.protected voidTake a short break before plowing into the pending work again.protected voidtakeNap()Take a nap before checking for more pending work.protected voidGo on an extended vacation until there is any pending work.voidwakeNow()Force the daemon to wake up immediately.Methods inherited from class com.tangosol.util.Daemon
changeState, configureWorker, ensureThreadGroup, finishStarting, finishStopping, getConfiguredName, getConfiguredPriority, getContext, getDescription, getGuardRegisterAction, getMaxWaitMillis, getState, getThread, getThreadContextClassLoader, getWorker, guardIfNeeded, heartbeat, heartbeat, instantiateWorker, isGuarded, isOnWorkerThread, isRunning, isStopping, recover, setConfiguredName, setConfiguredPriority, setContext, setGuardPolicy, setGuardRegisterAction, setThreadContextClassLoader, shutdown, start, stop, terminate, toStateString, toStringMethods 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
-
Constructor Details
-
QueueDaemon
public QueueDaemon()Construct a queue daemon to process pending writes.
-
-
Method Details
-
scheduleWork
public void scheduleWork()Notify the daemon that there is work to be done. -
wakeNow
public void wakeNow()Force the daemon to wake up immediately. -
isDone
public boolean isDone()Determine if the daemon thread should continue processing or should shut itself down. The daemon thread will continue processing as long as there is an underlying BinaryStore to write pending items to and the write-behind mode has not explicitly been disabled.- Returns:
- true if the daemon should shut itself down
-
run
public void run()This method is invoked on the daemon thread and performs the daemon processing until the thread stops. -
processPending
Store the specified value under the specific key in the underlying store, or if the value isAsyncBinaryStore.DELETEDthen erase the value from the underlying store.- Parameters:
binKey- key to store the value underbinValue- value to be stored
-
takeBreak
protected void takeBreak()Take a short break before plowing into the pending work again. This mode is used when there is already more work to do. -
takeNap
protected void takeNap()Take a nap before checking for more pending work. This mode is purposefully relaxed to let some work queue up before trying to process it. -
takeVacation
protected void takeVacation()Go on an extended vacation until there is any pending work. This is called a "dormant" mode in which this thread will go to sleep indefinitely and require another thread to wake it up should any work need to be done. -
isDormant
protected boolean isDormant()Determine whether the daemon is dormant or not.- Returns:
- true if the daemon is dormant, which means that the daemon must be woken up in order to do any work
-
setDormant
protected void setDormant(boolean fDormant) Specify whether the daemon is dormant or not.- Parameters:
fDormant- pass true if the daemon is going dormant, or false if the daemon is waking up from a dormant state
-