K
- the type of keys maintained by this cacheV
- the type of cached valuesT
- the type of the return valuepublic abstract class EntryProcessor<K,V,T> extends Object
Cache.Entry
atomically, according the defined
consistency of a Cache
.
Any Cache.Entry
mutations will not take effect until after the
process(MutableEntry, Object...)
method has completed execution.
If an exception is thrown by an EntryProcessor
, a Caching
Implementation must wrap any Exception
thrown wrapped in an EntryProcessorException
. If this occurs no mutations will be made to the
Cache.Entry
.
Implementations may execute EntryProcessor
s in situ, thus avoiding
locking, round-trips and expensive network transfers.
MutableEntry
operationsCache.Entry
access, via a call to Cache.Entry#getValue()
, will
behave as if Cache.get(Object)
was called for the key. This includes
updating necessary statistics, consulting the configured ExpiryPolicy
and loading from a configured CacheLoader
.
Cache.Entry
mutation, via a call to
MutableEntry.setValue(Object)
, will behave as if Cache.put(Object, Object)
was called for the key.
This includes updating necessary statistics, consulting the configured ExpiryPolicy
, notifying CacheEntryListener
s and writing to a
configured CacheWriter
.
Cache.Entry
removal, via a call to MutableEntry.remove()
, will
behave as if Cache.remove(Object)
was called for the key. This includes
updating necessary statistics, notifying CacheEntryListener
s and
causing a delete on a configured CacheWriter
.
As implementations may choose to execute EntryProcessor
s remotely,
EntryProcessor
s, together with specified parameters and return
values, may be required to implement Serializable
.
MutableEntry
operations performed by one EntryProcessor
EntryProcessor
calls:
Cache.Entry.getValue()
MutableEntry.setValue(Object)
Cache.Entry.getValue()
MutableEntry.setValue(Object)
Cache
effects:
EntryProcessor
calls:
This will have the following Cache
effects:
EntryProcessor
calls:
Cache.Entry.getValue()
MutableEntry.setValue(Object)
}Cache.Entry.getValue()
MutableEntry.setValue(Object)
MutableEntry.remove()
Cache
effects:
Constructor and Description |
---|
EntryProcessor() |
public abstract T process(MutableEntry<K,V> entry, Object... arguments) throws EntryProcessorException
entry
- the entryarguments
- a number of arguments to the process.EntryProcessorException
- if there is a failure in entry processing.Copyright © 2013. All Rights Reserved.