R - The revision type.
If the underlying cache storage supports the concept of revision to implement optimistic locking, then a client implementation should use that.
Otherwise set the cached value and check if the key is not updated at replace(AtomicCacheEntry, Serializer, Serializer)@Tags(value={"distributed","client","cluster","map","cache"}) @CapabilityDescription(value="Provides the ability to communicate with a DistributedMapCacheServer. This allows multiple nodes to coordinate state with a single remote entity.") public interface AtomicDistributedMapCacheClient<R> extends DistributedMapCacheClient
This interface defines an API that can be used for interacting with a
Distributed Cache that functions similarly to a Map.
In addition to the API defined in DistributedMapCacheClient super class,
this class provides methods for concurrent atomic updates those are added since Map Cache protocol version 2.
If a remote cache server doesn't support Map Cache protocol version 2, these methods throw UnsupportedOperationException.
| Modifier and Type | Method and Description |
|---|---|
<K,V> AtomicCacheEntry<K,V,R> |
fetch(K key,
Serializer<K> keySerializer,
Deserializer<V> valueDeserializer)
Fetch a CacheEntry with a key.
|
<K,V> boolean |
replace(AtomicCacheEntry<K,V,R> entry,
Serializer<K> keySerializer,
Serializer<V> valueSerializer)
Replace an existing key with new value.
|
close, containsKey, get, getAndPutIfAbsent, keySet, put, putAll, putIfAbsent, remove, removeAndGet, removeByPattern, removeByPatternAndGet, subMapinitializegetIdentifier, getPropertyDescriptor, getPropertyDescriptors, onPropertyModified, validate<K,V> AtomicCacheEntry<K,V,R> fetch(K key, Serializer<K> keySerializer, Deserializer<V> valueDeserializer) throws IOException
K - the key typeV - the value typekey - the key to lookup in the mapkeySerializer - key serializervalueDeserializer - value deserializerIOException - if unable to communicate with the remote instance<K,V> boolean replace(AtomicCacheEntry<K,V,R> entry, Serializer<K> keySerializer, Serializer<V> valueSerializer) throws IOException
K - the key typeV - the value typeentry - should provide the new value for AtomicCacheEntry.getValue(),
and the same revision in the cache storage for AtomicCacheEntry.getRevision(),
if the revision does not match with the one in the cache storage, value will not be replaced.keySerializer - key serializervalueSerializer - value serializerIOException - if unable to communicate with the remote instanceCopyright © 2020 Apache NiFi Project. All rights reserved.