public class SharedMapDecorator extends java.lang.Object implements SharedMap, java.io.Serializable
SharedMap
. By default, simply returns the map itself as the mutex.
Subclasses may override to return a different mutex object.Constructor and Description |
---|
SharedMapDecorator(java.util.Map map)
Creates a new shared map decorator.
|
Modifier and Type | Method and Description |
---|---|
void |
clear() |
boolean |
containsKey(java.lang.Object key) |
boolean |
containsValue(java.lang.Object value) |
java.util.Set |
entrySet() |
java.lang.Object |
get(java.lang.Object key) |
java.lang.Object |
getMutex()
Returns the shared mutex that may be synchronized on using a synchronized block.
|
boolean |
isEmpty() |
java.util.Set |
keySet() |
java.lang.Object |
put(java.lang.Object key,
java.lang.Object value) |
void |
putAll(java.util.Map map) |
java.lang.Object |
remove(java.lang.Object key) |
int |
size() |
java.lang.String |
toString() |
java.util.Collection |
values() |
public SharedMapDecorator(java.util.Map map)
map
- the map that is shared by multiple threads, to be syncedpublic void clear()
clear
in interface java.util.Map
public boolean containsKey(java.lang.Object key)
containsKey
in interface java.util.Map
public boolean containsValue(java.lang.Object value)
containsValue
in interface java.util.Map
public java.util.Set entrySet()
entrySet
in interface java.util.Map
public java.lang.Object get(java.lang.Object key)
get
in interface java.util.Map
public boolean isEmpty()
isEmpty
in interface java.util.Map
public java.util.Set keySet()
keySet
in interface java.util.Map
public java.lang.Object put(java.lang.Object key, java.lang.Object value)
put
in interface java.util.Map
public void putAll(java.util.Map map)
putAll
in interface java.util.Map
public java.lang.Object remove(java.lang.Object key)
remove
in interface java.util.Map
public int size()
size
in interface java.util.Map
public java.util.Collection values()
values
in interface java.util.Map
public java.lang.Object getMutex()
SharedMap
synchronized (sharedMap.getMutex()) { // do synchronized work }
public java.lang.String toString()
toString
in class java.lang.Object