|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object EDU.oswego.cs.dl.util.concurrent.SyncMap
public class SyncMap
SyncMaps wrap Sync-based control around java.util.Maps. They operate in the same way as SyncCollection.
Reader operations are
[ Introduction to this package. ]
SyncCollection
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface java.util.Map |
---|
java.util.Map.Entry<K,V> |
Field Summary | |
---|---|
protected java.util.Map |
c_
|
protected Sync |
rd_
|
protected SynchronizedLong |
syncFailures_
|
protected Sync |
wr_
|
Constructor Summary | |
---|---|
SyncMap(java.util.Map map,
ReadWriteLock rwl)
Create a new SyncMap protecting the given map, and using the given ReadWriteLock to control reader and writer methods. |
|
SyncMap(java.util.Map map,
Sync sync)
Create a new SyncMap protecting the given map, and using the given sync to control both reader and writer methods. |
|
SyncMap(java.util.Map map,
Sync readLock,
Sync writeLock)
Create a new SyncMap protecting the given map, and using the given pair of locks to control reader and writer methods. |
Method Summary | |
---|---|
protected void |
afterRead(boolean wasInterrupted)
Clean up after a reader operation |
protected boolean |
beforeRead()
Try to acquire sync before a reader operation; record failure |
void |
clear()
|
boolean |
containsKey(java.lang.Object o)
|
boolean |
containsValue(java.lang.Object o)
|
java.util.Set |
entrySet()
|
boolean |
equals(java.lang.Object o)
|
java.lang.Object |
get(java.lang.Object key)
|
int |
hashCode()
|
boolean |
isEmpty()
|
java.util.Set |
keySet()
|
java.lang.Object |
put(java.lang.Object key,
java.lang.Object value)
|
void |
putAll(java.util.Map coll)
|
Sync |
readerSync()
Return the Sync object managing read-only operations |
java.lang.Object |
remove(java.lang.Object key)
|
int |
size()
|
long |
syncFailures()
Return the number of synchronization failures for read-only operations |
java.util.Collection |
values()
|
Sync |
writerSync()
Return the Sync object managing mutative operations |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface java.util.Map |
---|
putAll |
Field Detail |
---|
protected final java.util.Map c_
protected final Sync rd_
protected final Sync wr_
protected final SynchronizedLong syncFailures_
Constructor Detail |
---|
public SyncMap(java.util.Map map, Sync sync)
public SyncMap(java.util.Map map, ReadWriteLock rwl)
public SyncMap(java.util.Map map, Sync readLock, Sync writeLock)
Method Detail |
---|
public Sync readerSync()
public Sync writerSync()
public long syncFailures()
protected boolean beforeRead()
protected void afterRead(boolean wasInterrupted)
public int hashCode()
hashCode
in interface java.util.Map
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in interface java.util.Map
equals
in class java.lang.Object
public int size()
size
in interface java.util.Map
public boolean isEmpty()
isEmpty
in interface java.util.Map
public boolean containsKey(java.lang.Object o)
containsKey
in interface java.util.Map
public boolean containsValue(java.lang.Object o)
containsValue
in interface java.util.Map
public java.lang.Object get(java.lang.Object key)
get
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 java.lang.Object remove(java.lang.Object key)
remove
in interface java.util.Map
public void putAll(java.util.Map coll)
public void clear()
clear
in interface java.util.Map
public java.util.Set keySet()
keySet
in interface java.util.Map
public java.util.Set entrySet()
entrySet
in interface java.util.Map
public java.util.Collection values()
values
in interface java.util.Map
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |