public class ClientMultiMapProxy<K,V> extends ClientProxy implements MultiMap<K,V>
| Modifier and Type | Field and Description |
|---|---|
protected static String |
NULL_KEY_IS_NOT_ALLOWED |
protected static String |
NULL_VALUE_IS_NOT_ALLOWED |
| Constructor and Description |
|---|
ClientMultiMapProxy(String serviceName,
String name) |
| Modifier and Type | Method and Description |
|---|---|
String |
addEntryListener(EntryListener<K,V> listener,
boolean includeValue)
Adds an entry listener for this multimap.
|
String |
addEntryListener(EntryListener<K,V> listener,
K key,
boolean includeValue)
Adds the specified entry listener for the specified key.
|
String |
addLocalEntryListener(EntryListener<K,V> listener)
Adds a local entry listener for this multimap.
|
<SuppliedValue,Result> |
aggregate(Supplier<K,V,SuppliedValue> supplier,
Aggregation<K,SuppliedValue,Result> aggregation)
Executes a predefined aggregation on the multimaps data set.
|
<SuppliedValue,Result> |
aggregate(Supplier<K,V,SuppliedValue> supplier,
Aggregation<K,SuppliedValue,Result> aggregation,
JobTracker jobTracker)
Executes a predefined aggregation on the multimaps data set.
|
void |
clear()
Clears the multimap.
|
boolean |
containsEntry(K key,
V value)
Returns whether the multimap contains the given key-value pair.
|
boolean |
containsKey(K key)
Returns whether the multimap contains an entry with the key.
|
boolean |
containsValue(Object value)
Returns whether the multimap contains an entry with the value.
|
Set<Map.Entry<K,V>> |
entrySet()
Returns the set of key-value pairs in the multimap.
|
void |
forceUnlock(K key)
Releases the lock for the specified key regardless of the lock owner.
|
Collection<V> |
get(K key)
Returns the collection of values associated with the key.
|
LocalMultiMapStats |
getLocalMultiMapStats()
Returns LocalMultiMapStats for this map.
|
protected long |
getTimeInMillis(long time,
TimeUnit timeunit) |
boolean |
isLocked(K key)
Checks the lock for the specified key.
|
Set<K> |
keySet()
Returns the set of keys in the multimap.
|
Set<K> |
localKeySet()
Returns the locally owned set of keys.
|
void |
lock(K key)
Acquires the lock for the specified key.
|
void |
lock(K key,
long leaseTime,
TimeUnit timeUnit)
Acquires the lock for the specified key for the specified lease time.
|
protected void |
onDestroy() |
boolean |
put(K key,
V value)
Stores a key-value pair in the multimap.
|
Collection<V> |
remove(Object key)
Removes all the entries with the given key.
|
boolean |
remove(Object key,
Object value)
Removes the given key value pair from the multimap.
|
boolean |
removeEntryListener(String registrationId)
Removes the specified entry listener
Returns silently if there is no such listener added before.
|
int |
size()
Returns the number of key-value pairs in the multimap.
|
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.
|
void |
unlock(K key)
Releases the lock for the specified key.
|
int |
valueCount(K key)
Returns number of values matching to given key in the multimap.
|
Collection<V> |
values()
Returns the collection of values in the multimap.
|
destroy, equals, getContext, getId, getName, getPartitionKey, getServiceName, hashCode, invoke, invoke, invoke, invokeInterruptibly, listen, listen, onShutdown, setContext, stopListening, throwExceptionIfNull, toData, toObjectclone, finalize, getClass, notify, notifyAll, wait, wait, waitdestroy, getId, getPartitionKey, getServiceNameprotected static final String NULL_KEY_IS_NOT_ALLOWED
protected static final String NULL_VALUE_IS_NOT_ALLOWED
public boolean put(K key, V value)
MultiMapWarning:
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.
public Collection<V> get(K key)
MultiMapWarning:
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.
Warning-2:
The collection is NOT backed by the map, so changes to the map are NOT reflected in the collection, and vice-versa.public boolean remove(Object key, Object value)
MultiMapWarning:
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.public Collection<V> remove(Object key)
MultiMapWarning:
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.
Warning-2:
The collection is NOT backed by the map, so changes to the map are NOT reflected in the collection, and vice-versa.public Set<K> localKeySet()
MultiMapWarning:
The set is NOT backed by the map, so changes to the map are NOT reflected in the set, and vice-versa.localKeySet in interface MultiMap<K,V>public Set<K> keySet()
MultiMapWarning:
The set is NOT backed by the map, so changes to the map are NOT reflected in the set, and vice-versa.public Collection<V> values()
MultiMapWarning:
The collection is NOT backed by the map, so changes to the map are NOT reflected in the collection, and vice-versa.public Set<Map.Entry<K,V>> entrySet()
MultiMapWarning:
The set is NOT backed by the map, so changes to the map are NOT reflected in the set, and vice-versa.public boolean containsKey(K key)
MultiMapWarning:
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.
containsKey in interface MultiMap<K,V>key - the key whose existence is checked.public boolean containsValue(Object value)
MultiMapcontainsValue in interface MultiMap<K,V>value - the value whose existence is checked.public boolean containsEntry(K key, V value)
MultiMapcontainsEntry in interface MultiMap<K,V>key - the key whose existence is checked.value - the value whose existence is checked.public int size()
MultiMappublic void clear()
MultiMappublic int valueCount(K key)
MultiMapWarning:
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.
valueCount in interface BaseMultiMap<K,V>valueCount in interface MultiMap<K,V>key - the key whose values count are to be returnedpublic String addLocalEntryListener(EntryListener<K,V> listener)
MultiMapmultimap.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 MultiMap<K,V>listener - entry listenerMultiMap.localKeySet()public String addEntryListener(EntryListener<K,V> listener, boolean includeValue)
MultiMapaddEntryListener in interface MultiMap<K,V>listener - entry listenerincludeValue - true if EntryEvent should
contain the value.public boolean removeEntryListener(String registrationId)
MultiMapremoveEntryListener in interface MultiMap<K,V>registrationId - Id of listener registrationpublic String addEntryListener(EntryListener<K,V> listener, K key, boolean includeValue)
MultiMapWarning:
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 MultiMap<K,V>listener - entry listenerkey - the key to listenincludeValue - true if EntryEvent should
contain the value.public void lock(K key)
MultiMapIf 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 multimap only. Acquired lock is only for the key in this multimap. 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 binary form of the key, not the actual implementations of hashCode and equals defined in key's class.
public void lock(K key, long leaseTime, TimeUnit timeUnit)
MultiMapAfter lease time, 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 binary form of the key, not the actual implementations of hashCode and equals defined in key's class.public boolean isLocked(K key)
MultiMapIf the lock is acquired then returns true, else false.
Warning:
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.public boolean tryLock(K key)
MultiMapIf the lock is not available then the current thread doesn't wait and returns false immediately.
Warning:
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.
public boolean tryLock(K key, long time, TimeUnit timeunit) throws InterruptedException
MultiMapIf 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 binary form of the key, not the actual implementations of hashCode and equals defined in key's class.
tryLock in interface MultiMap<K,V>time - the maximum time to wait for the locktimeunit - the time unit of the time argument.InterruptedExceptionpublic void unlock(K key)
MultiMapWarning:
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.
public void forceUnlock(K key)
MultiMapWarning:
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.forceUnlock in interface MultiMap<K,V>key - key to lock.public LocalMultiMapStats getLocalMultiMapStats()
MultiMapgetLocalMultiMapStats in interface MultiMap<K,V>public <SuppliedValue,Result> Result aggregate(Supplier<K,V,SuppliedValue> supplier, Aggregation<K,SuppliedValue,Result> aggregation)
MultiMapSupplier
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 MultiMap<K,V>SuppliedValue - the final type emitted from the supplierResult - the resulting aggregation value typesupplier - the supplier to select and / or extract a (sub-)value from the multimapaggregation - the aggregation that is being executed against the multimappublic <SuppliedValue,Result> Result aggregate(Supplier<K,V,SuppliedValue> supplier, Aggregation<K,SuppliedValue,Result> aggregation, JobTracker jobTracker)
MultiMapSupplier
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 MultiMap<K,V>SuppliedValue - the final type emitted from the supplierResult - the resulting aggregation value typesupplier - the supplier to select and / or extract a (sub-)value from the multimapaggregation - the aggregation that is being executed against the multimapjobTracker - the JobTracker instance to execute the aggregationprotected void onDestroy()
onDestroy in class ClientProxyprotected long getTimeInMillis(long time,
TimeUnit timeunit)
Copyright © 2015 Hazelcast, Inc.. All Rights Reserved.