public class CacheEventQueue extends java.lang.Object implements ICacheEventQueue
This is a modified version of the experimental version. It should lazy initilaize the processor thread, and kill the thread if the queue goes emtpy for a specified period, now set to 1 minute. If something comes in after that a new processor thread should be created.
POOLED_QUEUE_TYPE, SINGLE_QUEUE_TYPE| Constructor and Description |
|---|
CacheEventQueue(ICacheListener listener,
long listenerId,
java.lang.String cacheName)
Constructs with the specified listener and the cache name.
|
CacheEventQueue(ICacheListener listener,
long listenerId,
java.lang.String cacheName,
int maxFailure,
int waitBeforeRetry)
Constructor for the CacheEventQueue object
|
| Modifier and Type | Method and Description |
|---|---|
void |
addDisposeEvent()
Adds a feature to the DisposeEvent attribute of the ICacheEventQueue
object
|
void |
addPutEvent(ICacheElement ce)
This adds a put event to the queue.
|
void |
addRemoveAllEvent()
This adds a remove all event to the queue.
|
void |
addRemoveEvent(java.io.Serializable key)
This adds a remove event to the queue.
|
void |
destroy()
Event Q is emtpy.
|
long |
getListenerId()
Gets the listenerId attribute of the ICacheEventQueue object
|
java.lang.String |
getQueueType()
What type of queue is this.
|
IStats |
getStatistics()
This method returns semi-structured data on this queue.
|
int |
getWaitToDieMillis()
Returns the time to wait for events before killing the background thread.
|
void |
initialize(ICacheListener listener,
long listenerId,
java.lang.String cacheName,
int maxFailure,
int waitBeforeRetry,
java.lang.String threadPoolName)
Initializes the queue.
|
boolean |
isAlive()
If they queue has an active thread it is considered alive.
|
boolean |
isEmpty()
Are there elements in the queue.
|
boolean |
isWorking()
A Queue is working unless it has reached its max failure count.
|
void |
setAlive(boolean aState)
Sets whether the queue is actively processing -- if there are working threads.
|
void |
setWaitToDieMillis(int wtdm)
Sets the time to wait for events before killing the background thread.
|
void |
setWorking(boolean b)
This means that the queue is functional.
|
int |
size()
Returns the number of elements in the queue.
|
void |
stopProcessing()
Kill the processor thread and indicate that the queue is detroyed and no longer alive, but it
can still be working.
|
java.lang.String |
toString()
Creates a brief string identifying the listener and the region.
|
public CacheEventQueue(ICacheListener listener, long listenerId, java.lang.String cacheName)
listener - listenerId - cacheName - public CacheEventQueue(ICacheListener listener, long listenerId, java.lang.String cacheName, int maxFailure, int waitBeforeRetry)
listener - listenerId - cacheName - maxFailure - waitBeforeRetry - public void initialize(ICacheListener listener, long listenerId, java.lang.String cacheName, int maxFailure, int waitBeforeRetry, java.lang.String threadPoolName)
initialize in interface ICacheEventQueuelistener - listenerId - cacheName - maxFailure - waitBeforeRetry - threadPoolName - public java.lang.String getQueueType()
getQueueType in interface ICacheEventQueuepublic void stopProcessing()
public int getWaitToDieMillis()
public void setWaitToDieMillis(int wtdm)
wtdm - the ms for the q to sit idle.public java.lang.String toString()
toString in class java.lang.Objectpublic boolean isAlive()
isAlive in interface ICacheEventQueuepublic void setAlive(boolean aState)
aState - public long getListenerId()
ICacheEventQueuegetListenerId in interface ICacheEventQueuepublic void destroy()
Calling destroy interupts the processor thread.
destroy in interface ICacheEventQueuepublic void addPutEvent(ICacheElement ce) throws java.io.IOException
addPutEvent in interface ICacheEventQueuece - The feature to be added to the PutEvent attributejava.io.IOExceptionpublic void addRemoveEvent(java.io.Serializable key)
throws java.io.IOException
addRemoveEvent in interface ICacheEventQueuekey - The feature to be added to the RemoveEvent attributejava.io.IOExceptionpublic void addRemoveAllEvent()
throws java.io.IOException
addRemoveAllEvent in interface ICacheEventQueuejava.io.IOExceptionpublic void addDisposeEvent()
throws java.io.IOException
ICacheEventQueueaddDisposeEvent in interface ICacheEventQueuejava.io.IOExceptionpublic IStats getStatistics()
getStatistics in interface ICacheEventQueueICacheEventQueue.getStatistics()public boolean isWorking()
ICacheEventQueueisWorking in interface ICacheEventQueuepublic void setWorking(boolean b)
b - public boolean isEmpty()
ICacheEventQueueisEmpty in interface ICacheEventQueuepublic int size()
size in interface ICacheEventQueueCopyright © 2002-2013 Apache Software Foundation. All Rights Reserved.