public abstract class AbstractWriteBehindQueue extends Object implements WriteBehind
| Constructor and Description |
|---|
AbstractWriteBehindQueue(CacheConfiguration config)
Create a new write behind queue.
|
| Modifier and Type | Method and Description |
|---|---|
protected abstract void |
addItem(SingleOperation operation)
Add an item to the write behind queue
|
void |
delete(CacheEntry entry)
Add a delete operation for the given cache entry
|
protected Thread |
getProcessingThread()
Backdoor to allow killing the processing thread for testing purposes.
|
abstract long |
getQueueSize()
Gets the best estimate for items in the queue still awaiting processing.
|
protected abstract List<SingleOperation> |
quarantineItems()
Quarantine items to be processed.
|
protected abstract void |
reinsertUnprocessedItems(List<SingleOperation> operations)
Reinsert any unfinished operations into the queue.
|
void |
setOperationsFilter(OperationsFilter filter)
Set the operations filter that should be used.
|
void |
start(CacheWriter writer)
Start the write behind queue with a cache writer
|
void |
stop()
Stop the coordinator and all the internal data structures.
|
void |
write(Element element)
Add a write operation for a given element.
|
public AbstractWriteBehindQueue(CacheConfiguration config)
config - the configuration for the queueprotected abstract List<SingleOperation> quarantineItems()
protected abstract void addItem(SingleOperation operation)
operation - operation to be doneprotected abstract void reinsertUnprocessedItems(List<SingleOperation> operations)
operations - list of unfinished operationspublic void start(CacheWriter writer)
start in interface WriteBehindwriter - the cache writer that should be used to process the operationsWriteBehind.stop()public void setOperationsFilter(OperationsFilter filter)
setOperationsFilter in interface WriteBehindfilter - the filter that will be used as of nowpublic void write(Element element)
write in interface WriteBehindelement - the element for which a write operation will be added to the write behind queuepublic void delete(CacheEntry entry)
delete in interface WriteBehindentry - the cache entry for which a delete operation will be added to the write behind queuepublic void stop()
throws CacheException
This stops as quickly as possible without losing any previously added items. However, no guarantees are made towards the processing of these items. It's highly likely that items are still inside the internal data structures and not processed.
stop in interface WriteBehindCacheExceptionWriteBehind.start(net.sf.ehcache.writer.CacheWriter)public abstract long getQueueSize()
getQueueSize in interface WriteBehindprotected Thread getProcessingThread()
Copyright 2001-2021, Terracotta, Inc.