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
Nested ClassesModifier and TypeClassDescriptionprotected classRetries before declaring failure.protected classThe cache should be disposed when this event is processed.protected classAn element should be put in the cache.protected classAll elements should be removed from the cache when this event is processed.protected classAn element should be removed from the cache.Nested classes/interfaces inherited from interface org.apache.commons.jcs3.engine.behavior.ICacheEventQueue
ICacheEventQueue.QueueType -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidThis adds a dispose event to the queue.voidaddPutEvent(ICacheElement<K, V> ce) This adds a put event to the queue.voidThis adds a remove all event to the queue.voidaddRemoveEvent(K key) This adds a remove event to the queue.protected StringlongGets the listenerId attribute of the ICacheEventQueue objectintReturns the time to wait for events before killing the background thread.protected voidinitialize(ICacheListener<K, V> listener, long listenerId, String cacheName, int maxFailure, int waitBeforeRetry) Initializes the queue.booleanA Queue is working unless it has reached its max failure count.protected abstract voidput(AbstractCacheEventQueue<K, V>.AbstractCacheEvent event) Adds an event to the queue.voidsetWaitToDieMillis(int wtdm) Sets the time to wait for events before killing the background thread.voidsetWorking(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, waitMethods 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:ICacheEventQueueGets the listenerId attribute of the ICacheEventQueue object- Specified by:
getListenerIdin 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:
addPutEventin 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:
addRemoveEventin 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:
addRemoveAllEventin interfaceICacheEventQueue<K,V>
-
addDisposeEvent
This adds a dispose event to the queue. When it is processed, the cache is shut down- Specified by:
addDisposeEventin interfaceICacheEventQueue<K,V>
-
put
Adds an event to the queue.- Parameters:
event-
-
isWorking
Description copied from interface:ICacheEventQueueA Queue is working unless it has reached its max failure count.- Specified by:
isWorkingin 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-
-