|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.jcs.engine.CacheEventQueue
public class CacheEventQueue
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 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.
Field Summary |
---|
Fields inherited from interface org.apache.jcs.engine.behavior.ICacheEventQueue |
---|
POOLED_QUEUE_TYPE, SINGLE_QUEUE_TYPE |
Constructor Summary | |
---|---|
CacheEventQueue(ICacheListener listener,
long listenerId,
String cacheName)
Constructs with the specified listener and the cache name. |
|
CacheEventQueue(ICacheListener listener,
long listenerId,
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)
This adds a put event to the queue. |
void |
addRemoveAllEvent()
This adds a remove all event to the queue. |
void |
addRemoveEvent(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 |
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,
String cacheName,
int maxFailure,
int waitBeforeRetry,
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. |
String |
toString()
Creates a brief string identifying the listener and the region. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public CacheEventQueue(ICacheListener listener, long listenerId, String cacheName)
listener
- listenerId
- cacheName
- public CacheEventQueue(ICacheListener listener, long listenerId, String cacheName, int maxFailure, int waitBeforeRetry)
listener
- listenerId
- cacheName
- maxFailure
- waitBeforeRetry
- Method Detail |
---|
public void initialize(ICacheListener listener, long listenerId, String cacheName, int maxFailure, int waitBeforeRetry, String threadPoolName)
initialize
in interface ICacheEventQueue
listener
- listenerId
- cacheName
- maxFailure
- waitBeforeRetry
- threadPoolName
- public String getQueueType()
getQueueType
in interface ICacheEventQueue
public void stopProcessing()
public int getWaitToDieMillis()
public void setWaitToDieMillis(int wtdm)
wtdm
- the ms for the q to sit idle.public String toString()
toString
in class Object
public boolean isAlive()
isAlive
in interface ICacheEventQueue
public void setAlive(boolean aState)
aState
- public long getListenerId()
ICacheEventQueue
getListenerId
in interface ICacheEventQueue
public void destroy()
Calling destroy interupts the processor thread.
destroy
in interface ICacheEventQueue
public void addPutEvent(ICacheElement ce) throws IOException
addPutEvent
in interface ICacheEventQueue
ce
- The feature to be added to the PutEvent attribute
IOException
public void addRemoveEvent(Serializable key) throws IOException
addRemoveEvent
in interface ICacheEventQueue
key
- The feature to be added to the RemoveEvent attribute
IOException
public void addRemoveAllEvent() throws IOException
addRemoveAllEvent
in interface ICacheEventQueue
IOException
public void addDisposeEvent() throws IOException
ICacheEventQueue
addDisposeEvent
in interface ICacheEventQueue
IOException
public IStats getStatistics()
getStatistics
in interface ICacheEventQueue
ICacheEventQueue.getStatistics()
public boolean isWorking()
ICacheEventQueue
isWorking
in interface ICacheEventQueue
public void setWorking(boolean b)
b
- public boolean isEmpty()
ICacheEventQueue
isEmpty
in interface ICacheEventQueue
public int size()
size
in interface ICacheEventQueue
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |