K - key typeV - value typepublic class ReplicatedMapProxy<K,V> extends AbstractDistributedObject implements ReplicatedMap<K,V>, InitializingObject
ReplicatedMap implementation proxying the requests to the underlying
PARTITIONING_STRATEGY| Modifier and Type | Method and Description |
|---|---|
String |
addEntryListener(EntryListener<K,V> listener)
Adds an entry listener for this map.
|
String |
addEntryListener(EntryListener<K,V> listener,
K key)
Adds the specified entry listener for the specified key.
|
String |
addEntryListener(EntryListener<K,V> listener,
Predicate<K,V> predicate)
Adds an continuous entry listener for this map.
|
String |
addEntryListener(EntryListener<K,V> listener,
Predicate<K,V> predicate,
K key)
Adds an continuous entry listener for this map.
|
void |
clear()
The clear operation is thought for wiping data out of the replicated maps.
|
boolean |
containsKey(Object key) |
boolean |
containsValue(Object value) |
Set<Map.Entry<K,V>> |
entrySet()
Returns a
Set view of the mappings contained in this map. |
V |
get(Object key) |
String |
getName()
Returns the unique name for this DistributedObject.
|
String |
getPartitionKey()
Returns the key of partition this DistributedObject is assigned to.
|
LocalReplicatedMapStats |
getReplicatedMapStats() |
String |
getServiceName()
Returns the service name for this object.
|
int |
hashCode() |
void |
initialize() |
boolean |
isEmpty() |
Set<K> |
keySet() |
V |
put(K key,
V value) |
V |
put(K key,
V value,
long ttl,
TimeUnit timeUnit)
Associates a given value to the specified key and replicates it to the
cluster.
|
void |
putAll(Map<? extends K,? extends V> m) |
V |
remove(Object key) |
boolean |
removeEntryListener(String id)
Removes the specified entry listener
Returns silently if there is no such listener added before.
|
void |
setPreReplicationHook(PreReplicationHook preReplicationHook) |
int |
size() |
boolean |
storageEquals(Object o) |
String |
toString() |
Collection<V> |
values()
Returns a
Collection view of the values contained in this map. |
Collection<V> |
values(Comparator<V> comparator)
Returns a
Collection view of the values contained in this map. |
destroy, equals, getId, getNameAsPartitionAwareData, getNodeEngine, getService, invalidate, postDestroy, throwNotActiveExceptionclone, finalize, getClass, notify, notifyAll, wait, wait, waitdestroy, getIdpublic String getName()
DistributedObjectgetName in interface DistributedObjectpublic String getPartitionKey()
DistributedObjectgetPartitionKey in interface DistributedObjectgetPartitionKey in class AbstractDistributedObjectpublic String getServiceName()
DistributedObjectgetServiceName in interface DistributedObjectgetServiceName in class AbstractDistributedObjectpublic boolean containsKey(Object key)
containsKey in interface Map<K,V>public boolean containsValue(Object value)
containsValue in interface Map<K,V>public V put(K key, V value, long ttl, TimeUnit timeUnit)
ReplicatedMapAssociates a given value to the specified key and replicates it to the cluster. If there is an old value it will be replaced by the specified one and is returned from the call.
In addition you have to specify a ttl and it's TimeUnit
to define when the value is outdated and should be removed from the
replicated map.
put in interface ReplicatedMap<K,V>key - key with which the specified value is to be associatedvalue - value to be associated with the specified keyttl - ttl to be associated with the specified key-value pairtimeUnit - TimeUnit to be used for the ttl valuepublic void clear()
ReplicatedMapThe clear operation is thought for wiping data out of the replicated maps. Therefor it is the only synchronous remote operation in this implementation, so be aware of the fact that this might be a slow operation.
If some node fails on executing the operation it is retried for at most of
3 times (on the failing nodes only). If not working after the third time this
method throws a CallTimeoutException back
to the caller.
public boolean removeEntryListener(String id)
ReplicatedMapremoveEntryListener in interface ReplicatedMap<K,V>id - id of registered listenerpublic String addEntryListener(EntryListener<K,V> listener)
ReplicatedMapaddEntryListener in interface ReplicatedMap<K,V>listener - entry listenerpublic String addEntryListener(EntryListener<K,V> listener, K key)
ReplicatedMapWarning:
This method uses hashCode and equals of binary form of the key, not the actual implementations of hashCode and equals defined in key's class.addEntryListener in interface ReplicatedMap<K,V>listener - entry listenerkey - key to listenpublic String addEntryListener(EntryListener<K,V> listener, Predicate<K,V> predicate)
ReplicatedMapaddEntryListener in interface ReplicatedMap<K,V>listener - entry listenerpredicate - predicate for filtering entriespublic String addEntryListener(EntryListener<K,V> listener, Predicate<K,V> predicate, K key)
ReplicatedMapaddEntryListener in interface ReplicatedMap<K,V>listener - entry listenerpredicate - predicate for filtering entrieskey - key to listenpublic Collection<V> values()
ReplicatedMapCollection view of the values contained in this map.
The collection is NOT backed by the map, so changes to the map are
NOT reflected in the collection, and vice-versa.ReplicatedMap.values(java.util.Comparator) to force reordering of the
elements before returning.public Collection<V> values(Comparator<V> comparator)
ReplicatedMapCollection view of the values contained in this map.
The collection is NOT backed by the map, so changes to the map are
NOT reflected in the collection, and vice-versa.Comparator before returning the elements.values in interface ReplicatedMap<K,V>comparator - the Comparator to sort the returned elementspublic Set<Map.Entry<K,V>> entrySet()
ReplicatedMapSet view of the mappings contained in this map.
The set is NOT backed by the map, so changes to the map are
NOT reflected in the set, and vice-versa.public boolean storageEquals(Object o)
public int hashCode()
public String toString()
toString in class AbstractDistributedObjectpublic void initialize()
initialize in interface InitializingObjectpublic LocalReplicatedMapStats getReplicatedMapStats()
public void setPreReplicationHook(PreReplicationHook preReplicationHook)
Copyright © 2014 Hazelcast, Inc.. All Rights Reserved.