|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.jcs.engine.AbstractCacheEventQueue<K,V>
org.apache.jcs.engine.CacheEventQueue<K,V>
public class CacheEventQueue<K extends Serializable,V extends Serializable>
An event queue is used to propagate ordered cache events to one and only one target listener.
This is a modified version of the experimental version. It should lazy initialize the processor thread, and kill the thread if the queue goes empty for a specified period, now set to 1 minute. If something comes in after that a new processor thread should be created.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class org.apache.jcs.engine.AbstractCacheEventQueue |
|---|
AbstractCacheEventQueue.AbstractCacheEvent, AbstractCacheEventQueue.DisposeEvent, AbstractCacheEventQueue.Node, AbstractCacheEventQueue.PutEvent, AbstractCacheEventQueue.RemoveAllEvent, AbstractCacheEventQueue.RemoveEvent |
| Field Summary | |
|---|---|
protected Object |
queueLock
sync |
| Fields inherited from class org.apache.jcs.engine.AbstractCacheEventQueue |
|---|
cacheName, DEFAULT_WAIT_TO_DIE_MILLIS, destroyed, listener, listenerId, log, maxFailure, waitBeforeRetry, waitToDieMillis, working |
| Fields inherited from interface org.apache.jcs.engine.behavior.ICacheEventQueue |
|---|
POOLED_QUEUE_TYPE, SINGLE_QUEUE_TYPE |
| Constructor Summary | |
|---|---|
CacheEventQueue(ICacheListener<K,V> listener,
long listenerId,
String cacheName)
Constructs with the specified listener and the cache name. |
|
CacheEventQueue(ICacheListener<K,V> listener,
long listenerId,
String cacheName,
int maxFailure,
int waitBeforeRetry)
Constructor for the CacheEventQueue object |
|
| Method Summary | |
|---|---|
void |
destroy()
Event Q is empty. |
String |
getQueueType()
What type of queue is this. |
IStats |
getStatistics()
This method returns semi-structured data on this queue. |
void |
initialize(ICacheListener<K,V> listener,
long listenerId,
String cacheName,
int maxFailure,
int waitBeforeRetry,
String threadPoolName)
Initializes the queue. |
boolean |
isEmpty()
Are there elements in the queue. |
protected void |
put(AbstractCacheEventQueue.AbstractCacheEvent event)
Adds an event to the queue. |
int |
size()
Returns the number of elements in the queue. |
void |
stopProcessing()
Kill the processor thread and indicate that the queue is destroyed and no longer alive, but it can still be working. |
protected AbstractCacheEventQueue.AbstractCacheEvent |
take()
Returns the next cache event from the queue or null if there are no events in the queue. |
| Methods inherited from class org.apache.jcs.engine.AbstractCacheEventQueue |
|---|
addDisposeEvent, addPutEvent, addRemoveAllEvent, addRemoveEvent, getListenerId, getWaitToDieMillis, isAlive, isWorking, setAlive, setWaitToDieMillis, setWorking, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected final Object queueLock
| Constructor Detail |
|---|
public CacheEventQueue(ICacheListener<K,V> listener,
long listenerId,
String cacheName)
listener - listenerId - cacheName -
public CacheEventQueue(ICacheListener<K,V> listener,
long listenerId,
String cacheName,
int maxFailure,
int waitBeforeRetry)
listener - listenerId - cacheName - maxFailure - waitBeforeRetry - | Method Detail |
|---|
public void initialize(ICacheListener<K,V> listener,
long listenerId,
String cacheName,
int maxFailure,
int waitBeforeRetry,
String threadPoolName)
listener - listenerId - cacheName - maxFailure - waitBeforeRetry - threadPoolName - public String getQueueType()
public void stopProcessing()
public void destroy()
Calling destroy interrupts the processor thread.
protected void put(AbstractCacheEventQueue.AbstractCacheEvent event)
put in class AbstractCacheEventQueue<K extends Serializable,V extends Serializable>event - protected AbstractCacheEventQueue.AbstractCacheEvent take()
We have an empty node at the head and the tail. When we take an item from the queue we move the next node to the head and then clear the value from that node. This value is returned.
When the queue is empty the head node is the same as the tail node.
public IStats getStatistics()
ICacheEventQueue.getStatistics()public boolean isEmpty()
ICacheEventQueue
public int size()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||