public class CacheEventQueue<K,V> extends AbstractCacheEventQueue<K,V>
This is a modified version of the experimental version. It should lazy initialize the processor thread, and kill the thread if the queue goes empty for a specified period, now set to 1 minute. If something comes in after that a new processor thread should be created.
Modifier and Type | Class and Description |
---|---|
protected class |
CacheEventQueue.QProcessor
This is the thread that works the queue.
|
AbstractCacheEventQueue.AbstractCacheEvent, AbstractCacheEventQueue.DisposeEvent, AbstractCacheEventQueue.PutEvent, AbstractCacheEventQueue.RemoveAllEvent, AbstractCacheEventQueue.RemoveEvent
ICacheEventQueue.QueueType
DEFAULT_WAIT_TO_DIE_MILLIS
Constructor and Description |
---|
CacheEventQueue(ICacheListener<K,V> listener,
long listenerId,
String cacheName)
Constructs with the specified listener and the cache name.
|
CacheEventQueue(ICacheListener<K,V> listener,
long listenerId,
String cacheName,
int maxFailure,
int waitBeforeRetry)
Constructor for the CacheEventQueue object
|
Modifier and Type | Method and Description |
---|---|
void |
destroy()
Event Q is empty.
|
ICacheEventQueue.QueueType |
getQueueType()
What type of queue is this.
|
IStats |
getStatistics()
This method returns semi-structured data on this queue.
|
boolean |
isEmpty()
Are there elements in the queue.
|
protected void |
put(AbstractCacheEventQueue.AbstractCacheEvent event)
Adds an event to the queue.
|
int |
size()
Returns the number of elements in the queue.
|
protected void |
stopProcessing()
Kill the processor thread and indicate that the queue is destroyed and no longer alive, but it
can still be working.
|
addDisposeEvent, addPutEvent, addRemoveAllEvent, addRemoveEvent, getCacheName, getListenerId, getWaitToDieMillis, initialize, isAlive, isWorking, setAlive, setWaitToDieMillis, setWorking, toString
public CacheEventQueue(ICacheListener<K,V> listener, long listenerId, String cacheName)
listener
- listenerId
- cacheName
- public CacheEventQueue(ICacheListener<K,V> listener, long listenerId, String cacheName, int maxFailure, int waitBeforeRetry)
listener
- listenerId
- cacheName
- maxFailure
- waitBeforeRetry
- public ICacheEventQueue.QueueType getQueueType()
protected void stopProcessing()
public void destroy()
Calling destroy interrupts the processor thread.
protected void put(AbstractCacheEventQueue.AbstractCacheEvent event)
put
in class AbstractCacheEventQueue<K,V>
event
- public IStats getStatistics()
ICacheEventQueue.getStatistics()
public boolean isEmpty()
ICacheEventQueue
public int size()
Copyright © 2002–2018 The Apache Software Foundation. All rights reserved.