K - the key type of map.V - the value type of map.public class MapProxyImpl<K,V> extends AbstractDistributedObject<MapService> implements IMap<K,V>, InitializingObject
IMap interface.| Modifier and Type | Field and Description |
|---|---|
protected LocalMapStatsImpl |
localMapStats |
protected String |
localMemberUuid |
protected LockProxySupport |
lockSupport |
protected MapConfig |
mapConfig |
protected MapServiceContext |
mapServiceContext |
protected String |
name |
protected static String |
NULL_AGGREGATOR_IS_NOT_ALLOWED |
protected static String |
NULL_KEY_IS_NOT_ALLOWED |
protected static String |
NULL_LISTENER_IS_NOT_ALLOWED |
protected static String |
NULL_PREDICATE_IS_NOT_ALLOWED |
protected static String |
NULL_PROJECTION_IS_NOT_ALLOWED |
protected static String |
NULL_VALUE_IS_NOT_ALLOWED |
protected MapOperationProvider |
operationProvider |
protected OperationService |
operationService |
protected IPartitionService |
partitionService |
protected PartitioningStrategy |
partitionStrategy |
protected SerializationService |
serializationService |
protected boolean |
statisticsEnabled |
protected Address |
thisAddress |
PARTITIONING_STRATEGY| Constructor and Description |
|---|
MapProxyImpl(String name,
MapService mapService,
NodeEngine nodeEngine,
MapConfig mapConfig) |
| Modifier and Type | Method and Description |
|---|---|
String |
addEntryListener(EntryListener listener,
boolean includeValue)
Adds an entry listener for this map.
|
String |
addEntryListener(EntryListener listener,
K key,
boolean includeValue)
Adds the specified entry listener for the specified key.
|
String |
addEntryListener(EntryListener listener,
Predicate<K,V> predicate,
boolean includeValue)
Adds an continuous entry listener for this map.
|
String |
addEntryListener(EntryListener listener,
Predicate<K,V> predicate,
K key,
boolean includeValue)
Adds an continuous entry listener for this map.
|
String |
addEntryListener(MapListener listener,
boolean includeValue)
Adds a
MapListener for this map. |
String |
addEntryListener(MapListener listener,
K key,
boolean includeValue)
Adds a
MapListener for this map. |
String |
addEntryListener(MapListener listener,
Predicate<K,V> predicate,
boolean includeValue)
Adds a
MapListener for this map. |
String |
addEntryListener(MapListener listener,
Predicate<K,V> predicate,
K key,
boolean includeValue)
Adds a
MapListener for this map. |
protected String |
addEntryListenerInternal(Object listener,
Data key,
boolean includeValue) |
protected String |
addEntryListenerInternal(Object listener,
Predicate predicate,
Data key,
boolean includeValue) |
void |
addIndex(String attribute,
boolean ordered) |
String |
addInterceptor(MapInterceptor interceptor)
Adds an interceptor for this map.
|
String |
addLocalEntryListener(EntryListener listener)
Adds a local entry listener for this map.
|
String |
addLocalEntryListener(EntryListener listener,
Predicate<K,V> predicate,
boolean includeValue)
Adds a local entry listener for this map.
|
String |
addLocalEntryListener(EntryListener listener,
Predicate<K,V> predicate,
K key,
boolean includeValue)
Adds a local entry listener for this map.
|
String |
addLocalEntryListener(MapListener listener)
Adds a
MapListener for this map. |
String |
addLocalEntryListener(MapListener listener,
Predicate<K,V> predicate,
boolean includeValue)
Adds a
MapListener for this map. |
String |
addLocalEntryListener(MapListener listener,
Predicate<K,V> predicate,
K key,
boolean includeValue)
Adds a local entry listener for this map.
|
String |
addLocalEntryListenerInternal(Object listener) |
String |
addLocalEntryListenerInternal(Object listener,
Predicate predicate,
Data key,
boolean includeValue) |
String |
addMapInterceptorInternal(MapInterceptor interceptor) |
String |
addPartitionLostListener(MapPartitionLostListener listener)
Adds a MapPartitionLostListener.
|
protected String |
addPartitionLostListenerInternal(MapPartitionLostListener listener) |
<R> R |
aggregate(Aggregator<Map.Entry<K,V>,R> aggregator)
Applies the aggregation logic on all map entries and returns the result
|
<R> R |
aggregate(Aggregator<Map.Entry<K,V>,R> aggregator,
Predicate<K,V> predicate)
Applies the aggregation logic on map entries filtered with the Predicated and returns the result
|
<SuppliedValue,Result> |
aggregate(Supplier<K,V,SuppliedValue> supplier,
Aggregation<K,SuppliedValue,Result> aggregation)
Executes a predefined aggregation on the maps data set.
|
<SuppliedValue,Result> |
aggregate(Supplier<K,V,SuppliedValue> supplier,
Aggregation<K,SuppliedValue,Result> aggregation,
JobTracker jobTracker)
Executes a predefined aggregation on the maps data set.
|
void |
clear()
This method clears the map and calls deleteAll on MapStore which if connected to a database,
will delete the records from that database.
|
void |
clearInternal() |
void |
clearMapOnly()
This method clears the map.
|
boolean |
containsKey(Object k)
Returns
true if this map contains an entry for the specified
key. |
protected boolean |
containsKeyInternal(Data key) |
boolean |
containsValue(Object v) |
boolean |
containsValueInternal(Data dataValue) |
protected <K> Iterable<Data> |
convertToData(Iterable<K> keys) |
void |
delete(Object k)
Removes the mapping for a key from this map if it is present
(optional operation).
|
protected void |
deleteInternal(Data key) |
Set |
entrySet()
Returns a
Set clone of the mappings contained in this map. |
Set |
entrySet(Predicate predicate)
Queries the map based on the specified predicate and
returns the matching entries.
|
boolean |
evict(Object key)
Evicts the specified key from this map.
|
void |
evictAll()
Evicts all keys from this map except the locked ones.
|
protected void |
evictAllInternal() |
protected boolean |
evictInternal(Data key)
Evicts a key from a map.
|
Map<K,Object> |
executeOnEntries(EntryProcessor entryProcessor)
Applies the user defined EntryProcessor to the all entries in the map.
|
Map<K,Object> |
executeOnEntries(EntryProcessor entryProcessor,
Predicate predicate)
Applies the user defined EntryProcessor to the entries in the map which satisfies provided predicate.
|
void |
executeOnEntriesInternal(EntryProcessor entryProcessor,
Predicate predicate,
List<Data> result)
|
Object |
executeOnKey(K key,
EntryProcessor entryProcessor)
Applies the user defined EntryProcessor to the entry mapped by the key.
|
Data |
executeOnKeyInternal(Data key,
EntryProcessor entryProcessor) |
InternalCompletableFuture<Object> |
executeOnKeyInternal(Data key,
EntryProcessor entryProcessor,
ExecutionCallback<Object> callback) |
Map<K,Object> |
executeOnKeys(Set<K> keys,
EntryProcessor entryProcessor)
Applies the user defined EntryProcessor to the entries mapped by the collection of keys.
|
Map |
executeOnKeysInternal(Set<Data> keys,
EntryProcessor entryProcessor) |
void |
flush() |
void |
forceUnlock(K key)
Releases the lock for the specified key regardless of the lock owner.
|
V |
get(Object k)
Returns the value for the specified key, or
null if this map does not contain this key. |
Map<K,V> |
getAll(Set<K> keys)
Returns the entries for the given keys.
|
protected void |
getAllObjectInternal(List<Data> keys,
List<Object> resultingKeyValuePairs) |
ICompletableFuture<V> |
getAsync(K k)
Asynchronously gets the given key.
|
protected InternalCompletableFuture<Data> |
getAsyncInternal(Data key) |
EntryView<K,V> |
getEntryView(K key)
Returns the EntryView for the specified key.
|
protected EntryView |
getEntryViewInternal(Data key) |
protected Object |
getInternal(Data key) |
LocalMapStats |
getLocalMapStats() |
protected MapConfig |
getMapConfig() |
protected MapQueryEngine |
getMapQueryEngine() |
String |
getName()
Returns the unique name for this DistributedObject.
|
MapOperationProvider |
getOperationProvider() |
PartitioningStrategy |
getPartitionStrategy() |
QueryCache<K,V> |
getQueryCache(String name)
Returns corresponding
QueryCache instance for the supplied name or null. |
QueryCache<K,V> |
getQueryCache(String name,
MapListener listener,
Predicate<K,V> predicate,
boolean includeValue)
Creates an always up to date snapshot of this
IMap according to the supplied parameters. |
QueryCache<K,V> |
getQueryCache(String name,
Predicate<K,V> predicate,
boolean includeValue)
Creates an always up to date snapshot of this
IMap according to the supplied parameters. |
String |
getServiceName()
Returns the service name for this object.
|
protected long |
getTimeInMillis(long time,
TimeUnit timeunit) |
int |
getTotalBackupCount() |
void |
initialize() |
protected Object |
invoke(Operation operation,
int partitionId) |
protected void |
invokePutAllOperationFactory(Address address,
long size,
int[] partitions,
MapEntries[] entries) |
boolean |
isEmpty() |
boolean |
isLocked(K k)
Checks the lock for the specified key.
|
protected boolean |
isMapStoreEnabled() |
Iterator<Map.Entry<K,V>> |
iterator(int fetchSize,
int partitionId,
boolean prefetchValues) |
Set<K> |
keySet()
Returns a set clone of the keys contained in this map.
|
Set<K> |
keySet(Predicate predicate)
Queries the map based on the specified predicate and
returns the keys of matching entries.
|
void |
loadAll(boolean replaceExistingValues)
Loads all keys into the store.
|
void |
loadAll(Set<K> keys,
boolean replaceExistingValues)
Loads the given keys.
|
protected void |
loadAllInternal(boolean replaceExistingValues) |
protected void |
loadInternal(Iterable<Data> dataKeys,
boolean replaceExistingValues)
Maps keys to corresponding partitions and sends operations to them.
|
Set<K> |
localKeySet()
Returns the locally owned set of keys.
|
Set<K> |
localKeySet(Predicate predicate)
Returns the keys of matching locally owned entries.
|
void |
lock(K key)
Acquires the lock for the specified key.
|
void |
lock(Object key,
long leaseTime,
TimeUnit timeUnit)
Acquires the lock for the specified key for the specified lease time.
|
protected boolean |
preDestroy() |
<R> Collection<R> |
project(Projection<Map.Entry<K,V>,R> projection)
Applies the projection logic on all map entries and returns the result
|
<R> Collection<R> |
project(Projection<Map.Entry<K,V>,R> projection,
Predicate<K,V> predicate)
Applies the projection logic on map entries filtered with the Predicated and returns the result
|
V |
put(K k,
V v)
Associates the specified value with the specified key in this map.
|
V |
put(K k,
V v,
long ttl,
TimeUnit timeunit)
Puts an entry into this map with a given ttl (time to live) value.
|
void |
putAll(Map<? extends K,? extends V> map) |
protected void |
putAllInternal(Map<?,?> map)
This method will group all puts per partition and send a
PutAllPartitionAwareOperationFactory per member. |
ICompletableFuture<V> |
putAsync(K key,
V value)
Asynchronously puts the given key and value.
|
ICompletableFuture<V> |
putAsync(K key,
V value,
long ttl,
TimeUnit timeunit)
Asynchronously puts the given key and value into this map with a given ttl (time to live) value.
|
protected InternalCompletableFuture<Data> |
putAsyncInternal(Data key,
Data value,
long ttl,
TimeUnit timeunit) |
V |
putIfAbsent(K k,
V v)
If the specified key is not already associated
with a value, associate it with the given value.
|
V |
putIfAbsent(K k,
V v,
long ttl,
TimeUnit timeunit)
Puts an entry into this map with a given ttl (time to live) value
if the specified key is not already associated with a value.
|
protected Data |
putIfAbsentInternal(Data key,
Data value,
long ttl,
TimeUnit timeunit) |
protected Data |
putInternal(Data key,
Data value,
long ttl,
TimeUnit timeunit) |
void |
putTransient(K k,
V v,
long ttl,
TimeUnit timeunit)
Same as
#put(K, V, long, java.util.concurrent.TimeUnit) except that MapStore, if defined,
will not be called to store/persist the entry. |
protected void |
putTransientInternal(Data key,
Data value,
long ttl,
TimeUnit timeunit) |
V |
remove(Object k)
Removes the mapping for a key from this map if it is present.
|
boolean |
remove(Object k,
Object v)
Removes the entry for a key only if currently mapped to a given value.
|
void |
removeAll(Predicate<K,V> predicate)
Removes all entries which match with the supplied predicate.
|
protected void |
removeAllInternal(Predicate predicate) |
ICompletableFuture<V> |
removeAsync(K key)
Asynchronously removes the given key, returning an
ICompletableFuture on which
the caller can provide an ExecutionCallback to be invoked upon remove operation
completion or block waiting for the operation to complete with Future.get(). |
protected InternalCompletableFuture<Data> |
removeAsyncInternal(Data key) |
boolean |
removeEntryListener(String id)
Removes the specified entry listener.
|
protected boolean |
removeEntryListenerInternal(String id) |
void |
removeInterceptor(String id)
Removes the given interceptor for this map so it will not intercept operations anymore.
|
protected Data |
removeInternal(Data key) |
protected boolean |
removeInternal(Data key,
Data value) |
void |
removeMapInterceptorInternal(String id) |
boolean |
removePartitionLostListener(String id)
Removes the specified map partition lost listener.
|
protected boolean |
removePartitionLostListenerInternal(String id) |
V |
replace(K k,
V v)
Replaces the entry for a key only if it is currently mapped to some value.
|
boolean |
replace(K k,
V o,
V v)
Replaces the entry for a key only if currently mapped to a given value.
|
protected Data |
replaceInternal(Data key,
Data value) |
protected boolean |
replaceInternal(Data key,
Data expect,
Data update) |
void |
set(K key,
V value)
Puts an entry into this map.
|
void |
set(K k,
V v,
long ttl,
TimeUnit timeunit)
Puts an entry into this map with a given ttl (time to live) value.
|
ICompletableFuture<Void> |
setAsync(K key,
V value)
Asynchronously puts the given key and value.
|
ICompletableFuture<Void> |
setAsync(K key,
V value,
long ttl,
TimeUnit timeunit)
Asynchronously puts the given key and value into this map with a given ttl (time to live) value.
|
protected InternalCompletableFuture<Data> |
setAsyncInternal(Data key,
Data value,
long ttl,
TimeUnit timeunit) |
protected void |
setInternal(Data key,
Data value,
long ttl,
TimeUnit timeunit) |
void |
setOperationProvider(MapOperationProvider operationProvider) |
int |
size() |
ICompletableFuture |
submitToKey(K key,
EntryProcessor entryProcessor)
Applies the user defined EntryProcessor to the entry mapped by the key.
|
void |
submitToKey(K key,
EntryProcessor entryProcessor,
ExecutionCallback callback)
Applies the user defined EntryProcessor to the entry mapped by the key with
specified ExecutionCallback to listen event status and returns immediately.
|
protected Data |
toData(Object object,
PartitioningStrategy partitioningStrategy) |
protected <T> T |
toObject(Object object) |
String |
toString() |
boolean |
tryLock(K key)
Tries to acquire the lock for the specified key.
|
boolean |
tryLock(K key,
long time,
TimeUnit timeunit)
Tries to acquire the lock for the specified key.
|
boolean |
tryLock(K key,
long time,
TimeUnit timeunit,
long leaseTime,
TimeUnit leaseTimeUnit)
Tries to acquire the lock for the specified key for the specified lease time.
|
boolean |
tryPut(K k,
V v,
long timeout,
TimeUnit timeunit)
Tries to put the given key and value into this map within a specified
timeout value.
|
protected boolean |
tryPutInternal(Data key,
Data value,
long timeout,
TimeUnit timeunit) |
boolean |
tryRemove(K key,
long timeout,
TimeUnit timeunit)
Tries to remove the entry with the given key from this map
within the specified timeout value.
|
protected boolean |
tryRemoveInternal(Data key,
long timeout,
TimeUnit timeunit) |
void |
unlock(K key)
Releases the lock for the specified key.
|
Collection<V> |
values()
Returns a collection clone of the values contained in this map.
|
Collection<V> |
values(Predicate predicate)
Queries the map based on the specified predicate and
returns the values of matching entries.
|
void |
waitUntilLoaded() |
destroy, equals, getDistributedObjectName, getNameAsPartitionAwareData, getNodeEngine, getOperationService, getPartitionId, getPartitionKey, getService, hashCode, invalidate, invokeOnPartition, postDestroy, throwNotActiveException, toDataclone, equals, finalize, getClass, notify, notifyAll, wait, wait, waitaddIndex, flush, getLocalMapStatscompute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, replaceAlldestroy, getName, getPartitionKey, getServiceNameinitializeprotected static final String NULL_KEY_IS_NOT_ALLOWED
protected static final String NULL_VALUE_IS_NOT_ALLOWED
protected static final String NULL_PREDICATE_IS_NOT_ALLOWED
protected static final String NULL_LISTENER_IS_NOT_ALLOWED
protected static final String NULL_AGGREGATOR_IS_NOT_ALLOWED
protected static final String NULL_PROJECTION_IS_NOT_ALLOWED
protected final String name
protected final LocalMapStatsImpl localMapStats
protected final LockProxySupport lockSupport
protected final PartitioningStrategy partitionStrategy
protected final MapServiceContext mapServiceContext
protected final IPartitionService partitionService
protected final Address thisAddress
protected final OperationService operationService
protected final SerializationService serializationService
protected final boolean statisticsEnabled
protected final MapConfig mapConfig
protected final String localMemberUuid
protected MapOperationProvider operationProvider
public MapProxyImpl(String name, MapService mapService, NodeEngine nodeEngine, MapConfig mapConfig)
public V get(Object k)
IMapnull if this map does not contain this key.
Warning:
This method returns a clone of the original value, so modifying the returned value does not change the actual value in the map. You should put the modified value back to make changes visible to all nodes.
V value = map.get(key);
value.updateSomeProperty();
map.put(key, value);
Warning-2:
This method uses hashCode and equals of the binary form of the key, not the actual implementations of hashCode and equals defined in the key's class.public V put(K k, V v)
IMapWarning:
This method returns a clone of the previous value, not the original (identically equal) value previously put into the map.
Warning-2:
This method uses hashCode and equals of the binary form of the key, not the actual implementations of hashCode and equals defined in the key's class.public V put(K k, V v, long ttl, TimeUnit timeunit)
IMapWarning:
This method uses hashCode and equals of the binary form of the key, not the actual implementations of hashCode and equals defined in the key's class.Warning-2:
This method returns a clone of the previous value, not the original (identically equal) value previously put into the map.
Warning 3:
Time resolution for TTL is seconds. The given TTL value is rounded to the next closest second value.public boolean tryPut(K k, V v, long timeout, TimeUnit timeunit)
IMapWarning:
This method uses hashCode and equals of the binary form of the key, not the actual implementations of hashCode and equals defined in the key's class.public V putIfAbsent(K k, V v)
IMap
if (!map.containsKey(key))
return map.put(key, value);
else
return map.get(key);
except that the action is performed atomically.
Note:
This method uses hashCode and equals of the binary form of the key, not the actual implementations of hashCode and equals defined in the key's class.Also, this method returns a clone of the previous value, not the original (identically equal) value previously put into the map.
putIfAbsent in interface BaseMap<K,V>putIfAbsent in interface IMap<K,V>putIfAbsent in interface ConcurrentMap<K,V>putIfAbsent in interface Map<K,V>k - The specified key.v - The value to associate with the key when there is no previous value.public V putIfAbsent(K k, V v, long ttl, TimeUnit timeunit)
IMapWarning:
This method uses hashCode and equals of the binary form of the key, not the actual implementations of hashCode and equals defined in the key's class.Warning-2:
This method returns a clone of the previous value, not the original (identically equal) value previously put into the map.
Warning 3:
Time resolution for TTL is seconds. The given TTL value is rounded to the next closest second value.putIfAbsent in interface IMap<K,V>k - key of the entry.v - value of the entry.ttl - maximum time for this entry to stay in the map.timeunit - time unit for the ttl.public void putTransient(K k, V v, long ttl, TimeUnit timeunit)
IMap#put(K, V, long, java.util.concurrent.TimeUnit) except that MapStore, if defined,
will not be called to store/persist the entry. If ttl is 0, then
the entry lives forever.
Warning 1:
This method uses hashCode and equals of the binary form of the key, not the actual implementations of hashCode and equals defined in the key's class.Warning 2:
Time resolution for TTL is seconds. The given TTL value is rounded to next closest second value.putTransient in interface IMap<K,V>k - key of the entryv - value of the entryttl - maximum time for this entry to stay in the map.
0 means infinite.timeunit - time unit for the ttlpublic boolean replace(K k, V o, V v)
IMap
if (map.containsKey(key) && map.get(key).equals(oldValue)) {
map.put(key, newValue);
return true;
} else return false;
except that the action is performed atomically.
Warning:
This method uses hashCode and equals of the binary form of the key, not the actual implementations of hashCode and equals defined in the key's class.replace in interface BaseMap<K,V>replace in interface IMap<K,V>replace in interface ConcurrentMap<K,V>replace in interface Map<K,V>k - The specified key.o - Replace the key value if it is the old value.v - The new value to replace the old value.true if the value was replaced.public V replace(K k, V v)
IMap
if (map.containsKey(key)) {
return map.put(key, value);
} else return null;
except that the action is performed atomically.
Warning:
This method uses hashCode and equals of the binary form of the key, not the actual implementations of hashCode and equals defined in the key's class.Warning-2:
This method returns a clone of the previous value, not the original (identically equal) value previously put into the map.
replace in interface BaseMap<K,V>replace in interface IMap<K,V>replace in interface ConcurrentMap<K,V>replace in interface Map<K,V>k - The specified key.v - The value to replace the previous value.key, or null
if there was no mapping for key.public void set(K key, V value)
IMapWarning:
This method breaks the contract of EntryListener. When an entry is updated by set(), it fires an EntryEvent with a null oldValue.Warning-2:
This method uses hashCode and equals of the binary form of the key, not the actual implementations of hashCode and equals defined in the key's class.public void set(K k, V v, long ttl, TimeUnit timeunit)
IMapWarning 1:
This method uses hashCode and equals of the binary form of the key, not the actual implementations of hashCode and equals defined in the key's class.Warning 2:
Time resolution for TTL is seconds. The given TTL value is rounded to the next closest second value.public V remove(Object k)
IMapThe map will not contain a mapping for the specified key once the call returns.
Warning:
This method uses hashCode and equals of the binary form of the key, not the actual implementations of hashCode and equals defined in the key's class.
Warning-2:
This method returns a clone of the previous value, not the original (identically equal) value previously put into the map.
public boolean remove(Object k, Object v)
IMap
if (map.containsKey(key) && map.get(key).equals(value)) {
map.remove(key);
return true;
} else return false;
except that the action is performed atomically.
Warning:
This method uses hashCode and equals of the binary form of the key, not the actual implementations of hashCode and equals defined in the key's class.remove in interface BaseMap<K,V>remove in interface IMap<K,V>remove in interface ConcurrentMap<K,V>remove in interface Map<K,V>k - The specified key.v - Remove the key if it has this value.true if the value was removed.public void removeAll(Predicate<K,V> predicate)
IMappublic void delete(Object k)
IMapUnlike IMap.remove(Object), this operation does not return
the removed value, which avoids the serialization cost of the returned value.
The map will not contain a mapping for the specified key once the call returns.
Warning:
This method breaks the contract of EntryListener. When an entry is removed by delete(), it fires an EntryEvent with a null oldValue. Also, a listener with predicates will have null values, so only keys can be queried via predicates.public boolean containsKey(Object k)
IMaptrue if this map contains an entry for the specified
key.
Warning:
ˆ
This method uses hashCode and equals of the binary form of
the key, not the actual implementations of hashCode and equals
defined in the key's class. The key will first be searched for in memory. If the key is not
found, and if a key is attributed, a MapLoader will then attempt to load the key.
containsKey in interface BaseMap<K,V>containsKey in interface IMap<K,V>containsKey in interface Map<K,V>k - The specified key.true if this map contains an entry for the specified key.public boolean containsValue(Object v)
IMapcontainsValue in interface IMap<K,V>containsValue in interface Map<K,V>public void lock(K key)
IMapIf the lock is not available, then the current thread becomes disabled for thread scheduling purposes and lies dormant until the lock has been acquired.
You get a lock whether the value is present in the map or not. Other threads (possibly on other systems) would block on their invoke oflock() until the non-existent key is unlocked. If the lock
holder introduces the key to the map, the put() operation
is not blocked. If a thread not holding a lock on the non-existent key
tries to introduce the key while a lock exists on the non-existent key,
the put() operation blocks until it is unlocked.
Scope of the lock is this map only.
Acquired lock is only for the key in this map.
Locks are re-entrant so if the key is locked N times then
it should be unlocked N times before another thread can acquire it.
There is no lock timeout on this method. Locks will be held infinitely.
Warning:
This method uses hashCode and equals of the binary form of the key, not the actual implementations of hashCode and equals defined in the key's class.public void lock(Object key, long leaseTime, TimeUnit timeUnit)
IMapAfter lease time, the lock will be released.
If the lock is not available, then the current thread becomes disabled for thread scheduling purposes and lies dormant until the lock has been acquired.
Scope of the lock is this map only. Acquired lock is only for the key in this map. Locks are re-entrant, so if the key is locked N times then it should be unlocked N times before another thread can acquire it.Warning:
This method uses hashCode and equals of the binary form of the key, not the actual implementations of hashCode and equals defined in the key's class.public void unlock(K key)
IMapIf the current thread is the holder of this lock, then the hold
count is decremented. If the hold count is zero, then the lock
is released. If the current thread is not the holder of this
lock, then IllegalMonitorStateException is thrown.
Warning:
This method uses hashCode and equals of the binary form of the key, not the actual implementations of hashCode and equals defined in the key's class.public boolean tryRemove(K key, long timeout, TimeUnit timeunit)
IMapWarning:
This method uses hashCode and equals of the binary form of the key, not the actual implementations of hashCode and equals defined in the key's class.public ICompletableFuture<V> getAsync(K k)
IMapICompletableFuture future = map.getAsync(key); // do some other stuff, when ready get the result. Object value = future.get();
Future.get() will block until the actual map.get() completes.
If the application requires timely response,
then Future.get(long, TimeUnit) can be used.
try {
ICompletableFuture future = map.getAsync(key);
Object value = future.get(40, TimeUnit.MILLISECOND);
}
catch (TimeoutException t) {
// time wasn't enough
}
Additionally, the client can schedule an ExecutionCallback to be invoked upon
completion of the ICompletableFuture via
ICompletableFuture.andThen(ExecutionCallback) or
ICompletableFuture.andThen(ExecutionCallback, Executor):
// assuming a IMap<String, String>
ICompletableFuture<String> future = map.getAsync("a");
future.andThen(new ExecutionCallback<String>() {
public void onResponse(String response) {
// do something with value in response
}
public void onFailure(Throwable t) {
// handle failure
}
});
ExecutionException is never thrown.
Warning:
This method uses hashCode and equals of the binary form of the key, not the actual implementations of hashCode and equals defined in the key's class.getAsync in interface IMap<K,V>getAsync in interface LegacyAsyncMap<K,V>k - the key of the map entry.ICompletableFuturepublic boolean isLocked(K k)
IMapIf the lock is acquired then returns true, else returns false.
Warning:
This method uses hashCode and equals of the binary form of the key, not the actual implementations of hashCode and equals defined in the key's class.public ICompletableFuture<V> putAsync(K key, V value)
IMapICompletableFuture future = map.putAsync(key, value); // do some other stuff, when ready get the result. Object oldValue = future.get();ICompletableFuture.get() will block until the actual map.put() completes. If the application requires a timely response, then you can use Future.get(timeout, timeunit).
try {
ICompletableFuture future = map.putAsync(key, newValue);
Object oldValue = future.get(40, TimeUnit.MILLISECOND);
}
catch (TimeoutException t) {
// time wasn't enough
}
Additionally, the client can schedule an ExecutionCallback to be invoked upon
completion of the ICompletableFuture via ICompletableFuture.andThen(ExecutionCallback) or
ICompletableFuture.andThen(ExecutionCallback, Executor):
// assuming a IMap<String, String>
ICompletableFuture<String> future = map.putAsync("a", "b");
future.andThen(new ExecutionCallback<String>() {
public void onResponse(String response) {
// do something with the old value returned by put operation
}
public void onFailure(Throwable t) {
// handle failure
}
});
ExecutionException is never thrown.
Warning:
This method uses hashCode and equals of the binary form of the key, not the actual implementations of hashCode and equals defined in the key's class.putAsync in interface IMap<K,V>putAsync in interface LegacyAsyncMap<K,V>key - the key of the map entry.value - the new value of the map entry.ICompletableFuturepublic ICompletableFuture<V> putAsync(K key, V value, long ttl, TimeUnit timeunit)
IMapICompletableFuture future = map.putAsync(key, value, ttl, timeunit); // do some other stuff, when ready get the result Object oldValue = future.get();ICompletableFuture.get() will block until the actual map.put() completes. If your application requires a timely response, then you can use Future.get(timeout, timeunit).
try {
ICompletableFuture future = map.putAsync(key, newValue, ttl, timeunit);
Object oldValue = future.get(40, TimeUnit.MILLISECOND);
}
catch (TimeoutException t) {
// time wasn't enough
}
The client can schedule an ExecutionCallback to be invoked upon
completion of the ICompletableFuture via ICompletableFuture.andThen(ExecutionCallback) or
ICompletableFuture.andThen(ExecutionCallback, Executor):
// assuming a IMap<String, String>
ICompletableFuture<String> future = map.putAsync("a", "b", 5, TimeUnit.MINUTES);
future.andThen(new ExecutionCallback<String>() {
public void onResponse(String response) {
// do something with old value returned by put operation
}
public void onFailure(Throwable t) {
// handle failure
}
});
ExecutionException is never thrown.
Warning 1:
This method uses hashCode and equals of the binary form of the key, not the actual implementations of hashCode and equals defined in the key's class.Warning 2:
Time resolution for TTL is seconds. The given TTL value is rounded to the next closest second value.putAsync in interface IMap<K,V>putAsync in interface LegacyAsyncMap<K,V>key - the key of the map entry.value - the new value of the map entry.ttl - maximum time for this entry to stay in the map.
0 means infinite.timeunit - time unit for the ttl.ICompletableFuturepublic ICompletableFuture<Void> setAsync(K key, V value)
IMapICompletableFuture<Void> future = map.setAsync(key, value); // do some other stuff, when ready wait for completion future.get();ICompletableFuture.get() will block until the actual map.set() operation completes. If your application requires a timely response, then you can use ICompletableFuture.get(timeout, timeunit).
try {
ICompletableFuture<Void> future = map.setAsync(key, newValue);
future.get(40, TimeUnit.MILLISECOND);
}
catch (TimeoutException t) {
// time wasn't enough
}
You can also schedule an ExecutionCallback to be invoked upon
completion of the ICompletableFuture via ICompletableFuture.andThen(ExecutionCallback) or
ICompletableFuture.andThen(ExecutionCallback, Executor):
ICompletableFuture<Void> future = map.setAsync("a", "b");
future.andThen(new ExecutionCallback<String>() {
public void onResponse(Void response) {
// Set operation was completed
}
public void onFailure(Throwable t) {
// handle failure
}
});
ExecutionException is never thrown.
Warning 1:
This method uses hashCode and equals of the binary form of the key, not the actual implementations of hashCode and equals defined in the key's class.setAsync in interface IMap<K,V>setAsync in interface LegacyAsyncMap<K,V>key - the key of the map entry.value - the new value of the map entry.ExecutionCallback to be invoked upon completion.ICompletableFuturepublic ICompletableFuture<Void> setAsync(K key, V value, long ttl, TimeUnit timeunit)
IMap
ICompletableFuture<Void> future = map.setAsync(key, value, ttl, timeunit);
// do some other stuff, when you want to make sure set operation is complete:
future.get();
ICompletableFuture.get() will block until the actual map set operation completes.
If your application requires a timely response,
then you can use Future.get(long, TimeUnit).
try {
ICompletableFuture future = map.setAsync(key, newValue, ttl, timeunit);
future.get(40, TimeUnit.MILLISECOND);
}
catch (TimeoutException t) {
// time wasn't enough
}
You can also schedule an ExecutionCallback to be invoked upon
completion of the ICompletableFuture via ICompletableFuture.andThen(ExecutionCallback) or
ICompletableFuture.andThen(ExecutionCallback, Executor):
ICompletableFuture<Void> future = map.setAsync("a", "b", 5, TimeUnit.MINUTES);
future.andThen(new ExecutionCallback<String>() {
public void onResponse(Void response) {
// Set operation was completed
}
public void onFailure(Throwable t) {
// handle failure
}
});
ExecutionException is never thrown.
Warning 1:
This method uses hashCode and equals of the binary form of the key, not the actual implementations of hashCode and equals defined in the key's class.Warning 2:
Time resolution for TTL is seconds. The given TTL value is rounded to the next closest second value.setAsync in interface IMap<K,V>setAsync in interface LegacyAsyncMap<K,V>key - the key of the map entry.value - the new value of the map entry.ttl - maximum time for this entry to stay in the map.
0 means infinite.timeunit - time unit for the ttl.ExecutionCallback to be invoked
upon set operation completion.ICompletableFuturepublic ICompletableFuture<V> removeAsync(K key)
IMapICompletableFuture on which
the caller can provide an ExecutionCallback to be invoked upon remove operation
completion or block waiting for the operation to complete with Future.get().
Warning:
This method uses hashCode and equals of the binary form of the key, not the actual implementations of hashCode and equals defined in the key's class.removeAsync in interface IMap<K,V>removeAsync in interface LegacyAsyncMap<K,V>key - The key of the map entry to remove.ICompletableFuture from which the value removed from the map can be
retrieved.ICompletableFuturepublic Map<K,V> getAll(Set<K> keys)
IMapMapLoader.loadAll(java.util.Collection).
Warning:
The returned map is NOT backed by the original map, so changes to the original map are NOT reflected in the returned map, and vice-versa.Warning-2:
This method uses hashCode and equals of the binary form of the keys, not the actual implementations of hashCode and equals defined in the key's class.public void putAll(Map<? extends K,? extends V> map)
IMapNo atomicity guarantees are given. It could be that in case of failure some of the key/value-pairs get written, while others are not.
public boolean tryLock(K key)
IMapIf the lock is not available then the current thread doesn't wait and returns false immediately.
Warning:
This method uses hashCode and equals of the binary form of the key, not the actual implementations of hashCode and equals defined in the key's class.public boolean tryLock(K key, long time, TimeUnit timeunit) throws InterruptedException
IMapIf the lock is not available, then the current thread becomes disabled for thread scheduling purposes and lies dormant until one of two things happens:
Warning:
This method uses hashCode and equals of the binary form of the key, not the actual implementations of hashCode and equals defined in the key's class.tryLock in interface IMap<K,V>key - key to lock in this map.time - maximum time to wait for the lock.timeunit - time unit of the time argument.InterruptedExceptionpublic boolean tryLock(K key, long time, TimeUnit timeunit, long leaseTime, TimeUnit leaseTimeUnit) throws InterruptedException
IMapAfter lease time, the lock will be released.
If the lock is not available, then the current thread becomes disabled for thread scheduling purposes and lies dormant until one of two things happens:
Warning:
This method uses hashCode and equals of the binary form of the key, not the actual implementations of hashCode and equals defined in the key's class.tryLock in interface IMap<K,V>key - key to lock in this map.time - maximum time to wait for the lock.timeunit - time unit of the time argument.leaseTime - time to wait before releasing the lock.leaseTimeUnit - unit of time to specify lease time.InterruptedExceptionpublic void forceUnlock(K key)
IMapWarning:
This method uses hashCode and equals of the binary form of the key, not the actual implementations of hashCode and equals defined in the key's class.forceUnlock in interface IMap<K,V>key - the key to lock.public String addInterceptor(MapInterceptor interceptor)
IMapaddInterceptor in interface IMap<K,V>interceptor - map interceptor.public void removeInterceptor(String id)
IMapremoveInterceptor in interface IMap<K,V>id - registration id of the map interceptor.public String addLocalEntryListener(MapListener listener)
IMapMapListener for this map. To receive an event, you should
implement a corresponding MapListener sub-interface for that event.
Note that entries in distributed map are partitioned across
the cluster members; each member owns and manages the some portion of the
entries. Owned entries are called local entries. This
listener will be listening for the events of local entries. Let's say
your cluster has member1 and member2. On member2 you added a local listener and from
member1, you call map.put(key2, value2).
If the key2 is owned by member2 then the local listener will be
notified for the add/update event. Also note that entries can migrate to
other nodes for load balancing and/or membership change.addLocalEntryListener in interface IMap<K,V>listener - MapListener for this map.IMap.localKeySet(),
MapListenerpublic String addLocalEntryListener(EntryListener listener)
IMapmap.put(key2, value2).
If the key2 is owned by member2 then the local listener will be
notified for the add/update event. Also note that entries can migrate to
other nodes for load balancing and/or membership change.addLocalEntryListener in interface IMap<K,V>listener - entry listener.IMap.localKeySet()public String addLocalEntryListener(MapListener listener, Predicate<K,V> predicate, boolean includeValue)
IMapMapListener for this map. To receive an event, you should
implement a corresponding MapListener sub-interface for that event.
Listener will get notified for map events filtered by the given predicate.addLocalEntryListener in interface IMap<K,V>listener - MapListener for this map.predicate - predicate for filtering entriesincludeValue - true if EntryEvent should
contain the value.MapListenerpublic String addLocalEntryListener(EntryListener listener, Predicate<K,V> predicate, boolean includeValue)
IMapaddLocalEntryListener in interface IMap<K,V>listener - entry listenerpredicate - predicate for filtering entriesincludeValue - true if EntryEvent should
contain the value.public String addLocalEntryListener(MapListener listener, Predicate<K,V> predicate, K key, boolean includeValue)
IMapaddLocalEntryListener in interface IMap<K,V>listener - MapListener for this map.predicate - predicate for filtering entries.key - key to listen for.includeValue - true if EntryEvent should
contain the value.MapListenerpublic String addLocalEntryListener(EntryListener listener, Predicate<K,V> predicate, K key, boolean includeValue)
IMapaddLocalEntryListener in interface IMap<K,V>listener - entry listener.predicate - predicate for filtering entries.key - key to listen for.includeValue - true if EntryEvent should
contain the value.public String addEntryListener(MapListener listener, boolean includeValue)
IMapMapListener for this map. To receive an event, you should
implement a corresponding MapListener sub-interface for that event.addEntryListener in interface IMap<K,V>listener - MapListener for this map.includeValue - true if EntryEvent should
contain the value.MapListenerpublic String addEntryListener(EntryListener listener, boolean includeValue)
IMapaddEntryListener in interface IMap<K,V>listener - the added entry listener for this map.includeValue - true if EntryEvent should
contain the value.public String addEntryListener(MapListener listener, K key, boolean includeValue)
IMapMapListener for this map. To receive an event, you should
implement a corresponding MapListener sub-interface for that event.
Warning:
This method uses hashCode and equals of the binary form of the key, not the actual implementations of hashCode and equals defined in the key's class.addEntryListener in interface IMap<K,V>listener - MapListener for this map.key - key to listen for.includeValue - true if EntryEvent should
contain the value.MapListenerpublic String addEntryListener(EntryListener listener, K key, boolean includeValue)
IMapWarning:
This method uses hashCode and equals of the binary form of the key, not the actual implementations of hashCode and equals defined in the key's class.addEntryListener in interface IMap<K,V>listener - specified entry listener.key - key to listen for.includeValue - true if EntryEvent should
contain the value.public String addEntryListener(MapListener listener, Predicate<K,V> predicate, K key, boolean includeValue)
IMapMapListener for this map. To receive an event, you should
implement a corresponding MapListener sub-interface for that event.addEntryListener in interface IMap<K,V>listener - the continuous MapListener for this map.predicate - predicate for filtering entries.key - key to listen for.includeValue - true if EntryEvent should
contain the value.MapListenerpublic String addEntryListener(EntryListener listener, Predicate<K,V> predicate, K key, boolean includeValue)
IMapaddEntryListener in interface IMap<K,V>listener - the continuous entry listener for this map.predicate - predicate for filtering entries.key - key to listen for.includeValue - true if EntryEvent should
contain the value.public String addEntryListener(MapListener listener, Predicate<K,V> predicate, boolean includeValue)
IMapMapListener for this map. To receive an event, you should
implement a corresponding MapListener sub-interface for that event.addEntryListener in interface IMap<K,V>listener - the added continuous MapListener for this map.predicate - predicate for filtering entries.includeValue - true if EntryEvent should
contain the value.MapListenerpublic String addEntryListener(EntryListener listener, Predicate<K,V> predicate, boolean includeValue)
IMapaddEntryListener in interface IMap<K,V>listener - the added continuous entry listener for this map.predicate - predicate for filtering entries.includeValue - true if EntryEvent should
contain the value.public boolean removeEntryListener(String id)
IMapremoveEntryListener in interface IMap<K,V>id - id of registered listener.public String addPartitionLostListener(MapPartitionLostListener listener)
IMapIMap.removePartitionLostListener(String) method.
There is no check for duplicate registrations, so if you register the listener twice, it will get events twice.
IMPORTANT: Please @see com.hazelcast.partition.PartitionLostListener for weaknesses.
IMPORTANT: Listeners registered from HazelcastClient may miss some of the map partition lost events due
to design limitations.addPartitionLostListener in interface IMap<K,V>listener - the added MapPartitionLostListener.IMap.removePartitionLostListener(String)public boolean removePartitionLostListener(String id)
IMapremovePartitionLostListener in interface IMap<K,V>id - id of registered listener.public EntryView<K,V> getEntryView(K key)
IMapWarning:
This method returns a clone of original mapping, modifying the returned value does not change the actual value in the map. One should put modified value back to make changes visible to all nodes.
Warning-2:
This method uses hashCode and equals of the binary form of the key, not the actual implementations of hashCode and equals defined in the key's class.getEntryView in interface IMap<K,V>key - the key of the entry.EntryViewpublic boolean evict(Object key)
IMapWarning:
This method uses hashCode and equals of the binary form of the key, not the actual implementations of hashCode and equals defined in the key's class.public void evictAll()
IMapIMap.clear() method.
The EVICT_ALL event is fired for any registered listeners.
See MapEvictedListener.mapEvicted(MapEvent) .evictAll in interface IMap<K,V>IMap.clear()public void loadAll(boolean replaceExistingValues)
IMappublic void loadAll(Set<K> keys, boolean replaceExistingValues)
IMappublic void clear()
public void clearMapOnly()
clear()public Set<K> keySet()
IMapWarning:
The set is NOT backed by the map, so changes to the map are NOT reflected in the set, and vice-versa. This method is always executed by a distributed query, so it may throw aQueryResultSizeExceededException
if GroupProperty.QUERY_RESULT_SIZE_LIMIT is configured.public Set<K> keySet(Predicate predicate)
IMapWarning:
The set is NOT backed by the map, so changes to the map are NOT reflected in the set, and vice-versa. This method is always executed by a distributed query, so it may throw aQueryResultSizeExceededException
if GroupProperty.QUERY_RESULT_SIZE_LIMIT is configured.keySet in interface IMap<K,V>predicate - specified query criteria.GroupProperty.QUERY_RESULT_SIZE_LIMITpublic Set entrySet()
IMapSet clone of the mappings contained in this map.
Warning:
The set is NOT backed by the map, so changes to the map are NOT reflected in the set, and vice-versa. This method is always executed by a distributed query, so it may throw aQueryResultSizeExceededException
if GroupProperty.QUERY_RESULT_SIZE_LIMIT is configured.public Set entrySet(Predicate predicate)
IMapWarning:
The set is NOT backed by the map, so changes to the map are NOT reflected in the set, and vice-versa. This method is always executed by a distributed query, so it may throw aQueryResultSizeExceededException
if GroupProperty.QUERY_RESULT_SIZE_LIMIT is configured.entrySet in interface IMap<K,V>predicate - specified query criteria.GroupProperty.QUERY_RESULT_SIZE_LIMITpublic Collection<V> values()
IMapWarning:
The collection is NOT backed by the map, so changes to the map are NOT reflected in the collection, and vice-versa. This method is always executed by a distributed query, so it may throw aQueryResultSizeExceededException
if GroupProperty.QUERY_RESULT_SIZE_LIMIT is configured.public Collection<V> values(Predicate predicate)
IMapWarning:
The collection is NOT backed by the map, so changes to the map are NOT reflected in the collection, and vice-versa. This method is always executed by a distributed query, so it may throw aQueryResultSizeExceededException
if GroupProperty.QUERY_RESULT_SIZE_LIMIT is configured.values in interface IMap<K,V>predicate - specified query criteria.GroupProperty.QUERY_RESULT_SIZE_LIMITpublic Set<K> localKeySet()
IMapWarning:
The set is NOT backed by the map, so changes to the map are NOT reflected in the set, and vice-versa. This method is always executed by a distributed query, so it may throw aQueryResultSizeExceededException
if GroupProperty.QUERY_RESULT_SIZE_LIMIT is configured.localKeySet in interface IMap<K,V>GroupProperty.QUERY_RESULT_SIZE_LIMITpublic Set<K> localKeySet(Predicate predicate)
IMapWarning:
The set is NOT backed by the map, so changes to the map are NOT reflected in the set, and vice-versa. This method is always executed by a distributed query, so it may throw aQueryResultSizeExceededException
if GroupProperty.QUERY_RESULT_SIZE_LIMIT is configured.localKeySet in interface IMap<K,V>predicate - specified query criteria.GroupProperty.QUERY_RESULT_SIZE_LIMITpublic Object executeOnKey(K key, EntryProcessor entryProcessor)
IMapexecuteOnKey in interface IMap<K,V>Offloadable,
ReadOnlypublic Map<K,Object> executeOnKeys(Set<K> keys, EntryProcessor entryProcessor)
IMapexecuteOnKeys in interface IMap<K,V>public void submitToKey(K key, EntryProcessor entryProcessor, ExecutionCallback callback)
IMapsubmitToKey in interface IMap<K,V>key - key to be processed.entryProcessor - processor to process the key.callback - to listen whether operation is finished or not.Offloadable,
ReadOnlypublic ICompletableFuture submitToKey(K key, EntryProcessor entryProcessor)
IMapsubmitToKey in interface IMap<K,V>submitToKey in interface LegacyAsyncMap<K,V>key - key to be processedentryProcessor - processor to process the keyOffloadable,
ReadOnly,
ICompletableFuturepublic Map<K,Object> executeOnEntries(EntryProcessor entryProcessor)
IMapexecuteOnEntries in interface IMap<K,V>public Map<K,Object> executeOnEntries(EntryProcessor entryProcessor, Predicate predicate)
IMapexecuteOnEntries in interface IMap<K,V>public <R> R aggregate(Aggregator<Map.Entry<K,V>,R> aggregator)
IMapFast-Aggregations are the successor of the Map-Reduce Aggregators. They are equivalent to the Map-Reduce Aggregators in most of the use-cases, but instead of running on the Map-Reduce engine they run on the Query infrastructure. Their performance is tens to hundreds times better due to the fact that they run in parallel for each partition and are highly optimized for speed and low memory consumption.
public <R> R aggregate(Aggregator<Map.Entry<K,V>,R> aggregator, Predicate<K,V> predicate)
IMapFast-Aggregations are the successor of the Map-Reduce Aggregators. They are equivalent to the Map-Reduce Aggregators in most of the use-cases, but instead of running on the Map-Reduce engine they run on the Query infrastructure. Their performance is tens to hundreds times better due to the fact that they run in parallel for each partition and are highly optimized for speed and low memory consumption.
public <R> Collection<R> project(Projection<Map.Entry<K,V>,R> projection)
IMappublic <R> Collection<R> project(Projection<Map.Entry<K,V>,R> projection, Predicate<K,V> predicate)
IMappublic <SuppliedValue,Result> Result aggregate(Supplier<K,V,SuppliedValue> supplier, Aggregation<K,SuppliedValue,Result> aggregation)
IMapSupplier
is used to either select or to select and extract a (sub-)value. A predefined set of aggregations can be found in
Aggregations.aggregate in interface IMap<K,V>SuppliedValue - the final type emitted from the supplier.Result - the resulting aggregation value type.supplier - the supplier to select and / or extract a (sub-)value from the map.aggregation - the aggregation that is being executed against the map.public <SuppliedValue,Result> Result aggregate(Supplier<K,V,SuppliedValue> supplier, Aggregation<K,SuppliedValue,Result> aggregation, JobTracker jobTracker)
IMapSupplier
is used to either select or to select and extract a (sub-)value. A predefined set of aggregations can be found in
Aggregations.aggregate in interface IMap<K,V>SuppliedValue - the final type emitted from the supplier.Result - the resulting aggregation value type.supplier - the supplier to select and / or extract a (sub-)value from the map.aggregation - the aggregation that is being executed against the map.jobTracker - the JobTracker instance to execute the aggregation.protected Object invoke(Operation operation, int partitionId) throws Throwable
Throwablepublic Iterator<Map.Entry<K,V>> iterator(int fetchSize, int partitionId, boolean prefetchValues)
public String toString()
toString in class AbstractDistributedObject<MapService>public QueryCache<K,V> getQueryCache(String name)
IMapQueryCache instance for the supplied name or null.
If there is a previously created QueryCache with the supplied name or if a declarative
configuration exists for the supplied name this method returns or creates the instance respectively,
otherwise returns null.getQueryCache in interface IMap<K,V>name - the name of QueryCacheQueryCache instance or null if there is no corresponding QueryCacheConfigQueryCachepublic QueryCache<K,V> getQueryCache(String name, Predicate<K,V> predicate, boolean includeValue)
IMapIMap according to the supplied parameters.
If there is a previously created QueryCache with the supplied name, this method returns that
QueryCache and ignores predicate and includeValue parameters. Otherwise it creates and returns
a new QueryCache instance.
Also note that if there exists a QueryCacheConfig for the supplied
name, predicate and includeValue parameters will overwrite corresponding ones
in QueryCacheConfig.getQueryCache in interface IMap<K,V>name - the name of QueryCachepredicate - the predicate for filtering entriesincludeValue - true if this QueryCache is allowed to cache values of entries, otherwise falseQueryCache instance with the supplied nameQueryCachepublic QueryCache<K,V> getQueryCache(String name, MapListener listener, Predicate<K,V> predicate, boolean includeValue)
IMapIMap according to the supplied parameters.
If there is a previously created QueryCache with the supplied name, this method returns that
QueryCache and ignores listener, predicate and includeValue parameters.
Otherwise it creates and returns a new QueryCache instance.
Also note that if there exists a QueryCacheConfig for the supplied
name, listener,predicate and includeValue parameters will overwrite corresponding ones
in QueryCacheConfig.getQueryCache in interface IMap<K,V>name - the name of QueryCachelistener - the MapListener which will be used to listen this QueryCachepredicate - the predicate for filtering entriesincludeValue - true if this QueryCache is allowed to cache values of entries, otherwise falseQueryCache instance with the supplied nameQueryCachepublic void initialize()
initialize in interface InitializingObjectprotected InternalCompletableFuture<Data> getAsyncInternal(Data key)
protected boolean tryPutInternal(Data key, Data value, long timeout, TimeUnit timeunit)
protected Data putIfAbsentInternal(Data key, Data value, long ttl, TimeUnit timeunit)
protected void putTransientInternal(Data key, Data value, long ttl, TimeUnit timeunit)
protected InternalCompletableFuture<Data> putAsyncInternal(Data key, Data value, long ttl, TimeUnit timeunit)
protected InternalCompletableFuture<Data> setAsyncInternal(Data key, Data value, long ttl, TimeUnit timeunit)
protected boolean evictInternal(Data key)
key - the key to evicttrue if eviction was successful, false otherwiseprotected void evictAllInternal()
protected void loadAllInternal(boolean replaceExistingValues)
protected void loadInternal(Iterable<Data> dataKeys, boolean replaceExistingValues)
protected void deleteInternal(Data key)
protected void removeAllInternal(Predicate predicate)
protected InternalCompletableFuture<Data> removeAsyncInternal(Data key)
protected boolean containsKeyInternal(Data key)
public void waitUntilLoaded()
public int size()
public boolean containsValueInternal(Data dataValue)
public boolean isEmpty()
protected void getAllObjectInternal(List<Data> keys, List<Object> resultingKeyValuePairs)
protected void putAllInternal(Map<?,?> map)
PutAllPartitionAwareOperationFactory per member.
If there are e.g. five keys for a single member, there will only be a single remote invocation
instead of having five remote invocations.
There is also an optional support for batching to send smaller packages.
Takes care about null checks for keys and values.protected void invokePutAllOperationFactory(Address address, long size, int[] partitions, MapEntries[] entries) throws Exception
Exceptionpublic void flush()
public void clearInternal()
public String addMapInterceptorInternal(MapInterceptor interceptor)
public void removeMapInterceptorInternal(String id)
public String addLocalEntryListenerInternal(Object listener, Predicate predicate, Data key, boolean includeValue)
protected String addEntryListenerInternal(Object listener, Data key, boolean includeValue)
protected String addEntryListenerInternal(Object listener, Predicate predicate, Data key, boolean includeValue)
protected boolean removeEntryListenerInternal(String id)
protected String addPartitionLostListenerInternal(MapPartitionLostListener listener)
protected boolean removePartitionLostListenerInternal(String id)
public Data executeOnKeyInternal(Data key, EntryProcessor entryProcessor)
public Map executeOnKeysInternal(Set<Data> keys, EntryProcessor entryProcessor)
public InternalCompletableFuture<Object> executeOnKeyInternal(Data key, EntryProcessor entryProcessor, ExecutionCallback<Object> callback)
public void executeOnEntriesInternal(EntryProcessor entryProcessor, Predicate predicate, List<Data> result)
protected <T> T toObject(Object object)
protected Data toData(Object object, PartitioningStrategy partitioningStrategy)
public void addIndex(String attribute, boolean ordered)
public LocalMapStats getLocalMapStats()
protected boolean preDestroy()
preDestroy in class AbstractDistributedObject<MapService>protected long getTimeInMillis(long time,
TimeUnit timeunit)
protected MapQueryEngine getMapQueryEngine()
protected boolean isMapStoreEnabled()
protected MapConfig getMapConfig()
public final String getName()
DistributedObjectDistributedObjectUtil.getName(DistributedObject)
because this might be also a PrefixedDistributedObject.getName in interface DistributedObjectpublic final String getServiceName()
DistributedObjectgetServiceName in interface DistributedObjectgetServiceName in class AbstractDistributedObject<MapService>public PartitioningStrategy getPartitionStrategy()
public void setOperationProvider(MapOperationProvider operationProvider)
public MapOperationProvider getOperationProvider()
public int getTotalBackupCount()
Copyright © 2017 Hazelcast, Inc.. All Rights Reserved.