Package org.apache.commons.jcs3.engine
Class AbstractCacheEventQueue<K,V>
java.lang.Object
org.apache.commons.jcs3.engine.AbstractCacheEventQueue<K,V>
- All Implemented Interfaces:
ICacheEventQueue<K,
V>
- Direct Known Subclasses:
PooledCacheEventQueue
An abstract base class to the different implementations
-
Nested Class Summary
Modifier and TypeClassDescriptionprotected class
Retries before declaring failure.protected class
The cache should be disposed when this event is processed.protected class
An element should be put in the cache.protected class
All elements should be removed from the cache when this event is processed.protected class
An element should be removed from the cache.Nested classes/interfaces inherited from interface org.apache.commons.jcs3.engine.behavior.ICacheEventQueue
ICacheEventQueue.QueueType
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
This adds a dispose event to the queue.void
addPutEvent
(ICacheElement<K, V> ce) This adds a put event to the queue.void
This adds a remove all event to the queue.void
addRemoveEvent
(K key) This adds a remove event to the queue.protected String
long
Gets the listenerId attribute of the ICacheEventQueue objectint
Returns the time to wait for events before killing the background thread.protected void
initialize
(ICacheListener<K, V> listener, long listenerId, String cacheName, int maxFailure, int waitBeforeRetry) Initializes the queue.boolean
A Queue is working unless it has reached its max failure count.protected abstract void
put
(AbstractCacheEventQueue<K, V>.AbstractCacheEvent event) Adds an event to the queue.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.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
Methods inherited from interface org.apache.commons.jcs3.engine.behavior.ICacheEventQueue
destroy, getQueueType, getStatistics, isEmpty, size
-
Field Details
-
DEFAULT_WAIT_TO_DIE_MILLIS
default- See Also:
-
-
Constructor Details
-
AbstractCacheEventQueue
public AbstractCacheEventQueue()
-
-
Method Details
-
getWaitToDieMillis
Returns the time to wait for events before killing the background thread.- Returns:
- int
-
setWaitToDieMillis
Sets the time to wait for events before killing the background thread.- Parameters:
wtdm
- the ms for the q to sit idle.
-
toString
Creates a brief string identifying the listener and the region. -
getListenerId
Description copied from interface:ICacheEventQueue
Gets the listenerId attribute of the ICacheEventQueue object- Specified by:
getListenerId
in interfaceICacheEventQueue<K,
V> - Returns:
- The listenerId value
-
getCacheName
- Returns:
- the cacheName
-
initialize
protected void initialize(ICacheListener<K, V> listener, long listenerId, String cacheName, int maxFailure, int waitBeforeRetry) Initializes the queue.- Parameters:
listener
-listenerId
-cacheName
-maxFailure
-waitBeforeRetry
-
-
addPutEvent
This adds a put event to the queue. When it is processed, the element will be put to the listener.- Specified by:
addPutEvent
in interfaceICacheEventQueue<K,
V> - Parameters:
ce
- The feature to be added to the PutEvent attribute- Throws:
IOException
-
addRemoveEvent
This adds a remove event to the queue. When processed the listener's remove method will be called for the key.- Specified by:
addRemoveEvent
in interfaceICacheEventQueue<K,
V> - Parameters:
key
- The feature to be added to the RemoveEvent attribute- Throws:
IOException
-
addRemoveAllEvent
This adds a remove all event to the queue. When it is processed, all elements will be removed from the cache.- Specified by:
addRemoveAllEvent
in interfaceICacheEventQueue<K,
V>
-
addDisposeEvent
This adds a dispose event to the queue. When it is processed, the cache is shut down- Specified by:
addDisposeEvent
in interfaceICacheEventQueue<K,
V>
-
put
Adds an event to the queue.- Parameters:
event
-
-
isWorking
Description copied from interface:ICacheEventQueue
A Queue is working unless it has reached its max failure count.- Specified by:
isWorking
in interfaceICacheEventQueue<K,
V> - Returns:
- whether the queue is functional.
-
setWorking
This means that the queue is functional. If we reached the max number of failures, the queue is marked as non functional and will never work again.- Parameters:
b
-
-