CoherenceTM v3.3
Copyright© 2000-2007 by Oracle Corporation

com.tangosol.io
Class AsyncBinaryStore.QueueDaemon

java.lang.Object
  extended by com.tangosol.util.Base
      extended by com.tangosol.util.Daemon
          extended by com.tangosol.io.AsyncBinaryStore.QueueDaemon
All Implemented Interfaces:
Runnable
Enclosing class:
AsyncBinaryStore

protected class AsyncBinaryStore.QueueDaemon
extends Daemon

A daemon that processes queued writes.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.tangosol.util.Daemon
Daemon.DaemonWorker
 
Constructor Summary
AsyncBinaryStore.QueueDaemon()
          Construct a queue daemon to process pending writes.
 
Method Summary
 boolean isDone()
          Determine if the daemon thread should continue processing or should shut itself down.
protected  boolean isDormant()
          Determine whether the daemon is dormant or not.
protected  void processPending(Binary binKey, Binary binValue)
          Store the specified value under the specific key in the underlying store, or if the value is AsyncBinaryStore.DELETED then erase the value from the underlying store.
 void run()
          This method is invoked on the daemon thread and performs the daemon processing until the thread stops.
 void scheduleWork()
          Notify the daemon that there is work to be done.
protected  void setDormant(boolean fDormant)
          Specify whether the daemon is dormant or not.
protected  void takeBreak()
          Take a short break before plowing into the pending work again.
protected  void takeNap()
          Take a nap before checking for more pending work.
protected  void takeVacation()
          Go on an extended vacation until there is any pending work.
 void wakeNow()
          Force the daemon to wake up immediately.
 
Methods inherited from class com.tangosol.util.Daemon
changeState, configureWorker, getConfiguredName, getConfiguredPriority, getDescription, getState, getThread, getThreadContextClassLoader, getWorker, instantiateWorker, isOnWorkerThread, isRunning, isStopping, setConfiguredName, setConfiguredPriority, setThreadContextClassLoader, start, stop, toStateString, toString
 

Constructor Detail

AsyncBinaryStore.QueueDaemon

public AsyncBinaryStore.QueueDaemon()
Construct a queue daemon to process pending writes.

Method Detail

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.

Specified by:
run in interface Runnable
Specified by:
run in class Daemon

processPending

protected void processPending(Binary binKey,
                              Binary binValue)
Store the specified value under the specific key in the underlying store, or if the value is AsyncBinaryStore.DELETED then erase the value from the underlying store.

Parameters:
binKey - key to store the value under
binValue - 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

CoherenceTM v3.3
Copyright© 2000-2007 by Oracle Corporation