org.apache.jcs.engine
Class CacheEventQueue

java.lang.Object
  extended byorg.apache.jcs.engine.CacheEventQueue
All Implemented Interfaces:
ICacheEventQueue

public class CacheEventQueue
extends java.lang.Object
implements ICacheEventQueue

An event queue is used to propagate ordered cache events to one and only one target listener.


Nested Class Summary
private  class CacheEventQueue.AbstractCacheEvent
          Retries before declaring failure.
private  class CacheEventQueue.DisposeEvent
          Description of the Class
private static class CacheEventQueue.Node
           
private  class CacheEventQueue.PutEvent
           
private  class CacheEventQueue.QProcessor
           
private  class CacheEventQueue.RemoveAllEvent
          Description of the Class
private  class CacheEventQueue.RemoveEvent
          Description of the Class
 
Field Summary
private  java.lang.String cacheName
           
private  boolean destroyed
           
private  int failureCount
           
private  CacheEventQueue.Node head
           
private  ICacheListener listener
           
private  byte listenerId
           
private static org.apache.commons.logging.Log log
           
private  int maxFailure
           
private static int processorInstanceCount
           
private  java.lang.Object queueLock
           
private  java.lang.Thread t
           
private  CacheEventQueue.Node tail
           
private  int waitBeforeRetry
           
 
Constructor Summary
CacheEventQueue(ICacheListener listener, byte listenerId, java.lang.String cacheName)
          Constructs with the specified listener and the cache name.
CacheEventQueue(ICacheListener listener, byte listenerId, java.lang.String cacheName, int maxFailure, int waitBeforeRetry)
          Constructor for the CacheEventQueue object
 
Method Summary
 void addDisposeEvent()
          Adds a feature to the DisposeEvent attribute of the ICacheEventQueue object
 void addPutEvent(ICacheElement ce)
          Adds a feature to the PutEvent attribute of the ICacheEventQueue object
 void addRemoveAllEvent()
          Adds a feature to the RemoveAllEvent attribute of the ICacheEventQueue object
 void addRemoveEvent(java.io.Serializable key)
          Adds a feature to the RemoveEvent attribute of the ICacheEventQueue object
 void destroy()
          Event Q is emtpy.
 byte getListenerId()
          Gets the listenerId attribute of the ICacheEventQueue object
 boolean isAlive()
          Gets the alive attribute of the ICacheEventQueue object
private  void put(CacheEventQueue.AbstractCacheEvent event)
          Adds an event to the queue.
private  CacheEventQueue.AbstractCacheEvent take()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

log

private static final org.apache.commons.logging.Log log

processorInstanceCount

private static int processorInstanceCount

listener

private ICacheListener listener

listenerId

private byte listenerId

cacheName

private java.lang.String cacheName

failureCount

private int failureCount

maxFailure

private int maxFailure

waitBeforeRetry

private int waitBeforeRetry

destroyed

private boolean destroyed

t

private java.lang.Thread t

queueLock

private java.lang.Object queueLock

head

private CacheEventQueue.Node head

tail

private CacheEventQueue.Node tail
Constructor Detail

CacheEventQueue

public CacheEventQueue(ICacheListener listener,
                       byte listenerId,
                       java.lang.String cacheName)
Constructs with the specified listener and the cache name.

Parameters:
listener -
listenerId -
cacheName -

CacheEventQueue

public CacheEventQueue(ICacheListener listener,
                       byte listenerId,
                       java.lang.String cacheName,
                       int maxFailure,
                       int waitBeforeRetry)
Constructor for the CacheEventQueue object

Parameters:
listener -
listenerId -
cacheName -
maxFailure -
waitBeforeRetry -
Method Detail

destroy

public void destroy()
Event Q is emtpy.

Specified by:
destroy in interface ICacheEventQueue

toString

public java.lang.String toString()
Returns:

isAlive

public boolean isAlive()
Description copied from interface: ICacheEventQueue
Gets the alive attribute of the ICacheEventQueue object

Specified by:
isAlive in interface ICacheEventQueue
Returns:
The {3} value

getListenerId

public byte getListenerId()
Description copied from interface: ICacheEventQueue
Gets the listenerId attribute of the ICacheEventQueue object

Specified by:
getListenerId in interface ICacheEventQueue
Returns:
The {3} value

addPutEvent

public void addPutEvent(ICacheElement ce)
                 throws java.io.IOException
Description copied from interface: ICacheEventQueue
Adds a feature to the PutEvent attribute of the ICacheEventQueue object

Specified by:
addPutEvent in interface ICacheEventQueue
Parameters:
ce - The feature to be added to the PutEvent attribute
Throws:
java.io.IOException

addRemoveEvent

public void addRemoveEvent(java.io.Serializable key)
                    throws java.io.IOException
Description copied from interface: ICacheEventQueue
Adds a feature to the RemoveEvent attribute of the ICacheEventQueue object

Specified by:
addRemoveEvent in interface ICacheEventQueue
Parameters:
key - The feature to be added to the RemoveEvent attribute
Throws:
java.io.IOException

addRemoveAllEvent

public void addRemoveAllEvent()
                       throws java.io.IOException
Description copied from interface: ICacheEventQueue
Adds a feature to the RemoveAllEvent attribute of the ICacheEventQueue object

Specified by:
addRemoveAllEvent in interface ICacheEventQueue
Throws:
java.io.IOException

addDisposeEvent

public void addDisposeEvent()
                     throws java.io.IOException
Description copied from interface: ICacheEventQueue
Adds a feature to the DisposeEvent attribute of the ICacheEventQueue object

Specified by:
addDisposeEvent in interface ICacheEventQueue
Throws:
java.io.IOException

put

private void put(CacheEventQueue.AbstractCacheEvent event)
Adds an event to the queue.

Parameters:
event -

take

private CacheEventQueue.AbstractCacheEvent take()
                                         throws java.lang.InterruptedException
Throws:
java.lang.InterruptedException