|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.jcs.engine.PooledCacheEventQueue
public class PooledCacheEventQueue
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 uses a PooledExecutor and a BoundedBuffer to queue up events and execute them as threads become available.
The PooledExecutor is static, because presumably these processes will be IO bound, so throwing more than a few threads at them will serve no purpose other than to saturate the IO interface. In light of this, having one thread per region seems unnecessary. This may prove to be false.
Field Summary |
---|
Fields inherited from interface org.apache.jcs.engine.behavior.ICacheEventQueue |
---|
POOLED_QUEUE_TYPE, SINGLE_QUEUE_TYPE |
Constructor Summary | |
---|---|
PooledCacheEventQueue(ICacheListener listener,
long listenerId,
String cacheName,
int maxFailure,
int waitBeforeRetry,
String threadPoolName)
Constructor for the CacheEventQueue object |
Method Summary | |
---|---|
void |
addDisposeEvent()
Adds a feature to the DisposeEvent attribute of the ICacheEventQueue object |
void |
addPutEvent(ICacheElement ce)
Constructs a PutEvent for the object and passes it to the event queue. |
void |
addRemoveAllEvent()
Adds a feature to the RemoveAllEvent attribute of the ICacheEventQueue object |
void |
addRemoveEvent(Serializable key)
Adds a feature to the RemoveEvent attribute of the ICacheEventQueue object |
void |
destroy()
Destroy the queue. |
long |
getListenerId()
Gets the listenerId attribute of the ICacheEventQueue object |
String |
getQueueType()
Return the type of event queue we are using, either single or pooled. |
IStats |
getStatistics()
Returns the historical and statistical data for an event queue cache. |
String |
getStats()
|
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()
Gets the alive attribute of the ICacheEventQueue object. |
boolean |
isEmpty()
If the Queue is using a bounded channel we can determine the size. |
boolean |
isWorking()
A Queue is working unless it has reached its max failure count. |
void |
setAlive(boolean aState)
|
void |
setWaitToDieMillis(int wtdm)
Sets the time to wait for events before killing the background thread. |
void |
setWorking(boolean isWorkingArg)
|
int |
size()
Returns the number of elements in the queue. |
void |
stopProcessing()
Event Q is empty. |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public PooledCacheEventQueue(ICacheListener listener, long listenerId, String cacheName, int maxFailure, int waitBeforeRetry, String threadPoolName)
listener
- listenerId
- cacheName
- maxFailure
- waitBeforeRetry
- threadPoolName
- 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()
ICacheEventQueue
getQueueType
in interface ICacheEventQueue
public void stopProcessing()
public int getWaitToDieMillis()
public void setWaitToDieMillis(int wtdm)
wtdm
- public String toString()
toString
in class Object
public boolean isAlive()
ICacheEventQueue
isAlive
in interface ICacheEventQueue
public void setAlive(boolean aState)
aState
- public long getListenerId()
ICacheEventQueue
getListenerId
in interface ICacheEventQueue
public void destroy()
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
ICacheEventQueue
addRemoveEvent
in interface ICacheEventQueue
key
- The feature to be added to the RemoveEvent attribute
IOException
public void addRemoveAllEvent() throws IOException
ICacheEventQueue
addRemoveAllEvent
in interface ICacheEventQueue
IOException
public void addDisposeEvent() throws IOException
ICacheEventQueue
addDisposeEvent
in interface ICacheEventQueue
IOException
public String getStats()
public IStats getStatistics()
ICacheEventQueue
getStatistics
in interface ICacheEventQueue
public boolean isWorking()
ICacheEventQueue
isWorking
in interface ICacheEventQueue
public void setWorking(boolean isWorkingArg)
isWorkingArg
- whether the queue is functionalpublic boolean isEmpty()
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 |