K
- the type of keys maintained by this cacheV
- the type of cached valuesT
- the type of the return valuepublic interface EntryProcessor<K,V,T>
Cache.Entry
atomically, according to 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:
MutableEntry.getValue()
MutableEntry.setValue(Object)
MutableEntry.getValue()
MutableEntry.setValue(Object)
Cache
effects:
EntryProcessor
calls:
MutableEntry.getValue()
MutableEntry.remove()
}MutableEntry.getValue()
MutableEntry.setValue(Object)
Cache
effects:
EntryProcessor
calls:
MutableEntry.getValue()
MutableEntry.setValue(Object)
}MutableEntry.getValue()
MutableEntry.setValue(Object)
MutableEntry.remove()
Cache
effects:
Modifier and Type | Method | Description |
---|---|---|
T |
process(MutableEntry<K,V> entry,
Object... arguments) |
Process an entry.
|
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 © 2017. All rights reserved.