|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.terracotta.modules.ehcache.writebehind.CacheWriterWrapper
public class CacheWriterWrapper
An implementation of ItemProcessor that delegates the processing to a CacheWriter instance
CacheWriter
instances will not be shared across a Terracotta DSO cluster and are intended to be local on a node. They are tied to
an individual write behind queue. You're thus free to use local resources in an CacheWriter, like
database connections or file handles.
| Constructor Summary | |
|---|---|
CacheWriterWrapper(net.sf.ehcache.writer.CacheWriter cacheWriter,
SerializationStrategy serializationStrategy)
Creates a new item processor for a specific cache writer. |
|
| Method Summary | |
|---|---|
void |
process(Collection<SingleAsyncOperation> items)
This method is called from within ProcessingBucket when enqueued items are processed int batch. |
void |
process(SingleAsyncOperation operation)
This method is called from within ProcessingBucket when enqueued items are processed one by one. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public CacheWriterWrapper(net.sf.ehcache.writer.CacheWriter cacheWriter,
SerializationStrategy serializationStrategy)
cacheWriter - the cache writer for which the wrapper has to be createdserializationStrategy - the strategy that should be used to serialize and deserialize, if needed| Method Detail |
|---|
public void process(SingleAsyncOperation operation)
ItemProcessorProcessingBucket when enqueued items are processed one by one.
When this
process method finishes, the corresponding item will be definitively removed from the bucket. Note that while the
item removal is transactional and your implementation of the process method can be done in a transactional
fashion, they are not transactional together. It is thus possible that your ItemProcessor succeeds and that
the node goes down before the item is actually removed from the bucket. Your ItemProcessor thus might have
to be implemented with some form of bookkeeping that is able to detect that a certain item has already been
processed. This can for example be a check on a unique item identifier that is allocated before starting the actual
processing of a new item.
process in interface ItemProcessor<SingleAsyncOperation>operation - the item that has to be processedpublic void process(Collection<SingleAsyncOperation> items)
ItemProcessorProcessingBucket when enqueued items are processed int batch.
All documentation from the ItemProcessor.process(Object) method also applies here.
process in interface ItemProcessor<SingleAsyncOperation>items - the items that have to be processed
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||