|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectau.gov.tas.dpiwe.mr.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
[ Doug Lea's introduction to this package. ]
SyncCollection| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface java.util.Map |
|---|
Map.Entry |
| Field Summary | |
|---|---|
protected Map |
c_
|
protected Sync |
rd_
|
protected SynchronizedLong |
syncFailures_
|
protected Sync |
wr_
|
| Constructor Summary | |
|---|---|
SyncMap(Map map,
ReadWriteLock rwl)
Create a new SyncMap protecting the given map, and using the given ReadWriteLock to control reader and writer methods. |
|
SyncMap(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(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(Object o)
|
boolean |
containsValue(Object o)
|
Set |
entrySet()
|
boolean |
equals(Object o)
|
Object |
get(Object key)
|
int |
hashCode()
|
boolean |
isEmpty()
|
Set |
keySet()
|
Object |
put(Object key,
Object value)
|
void |
putAll(Map coll)
|
Sync |
readerSync()
Return the Sync object managing read-only operations |
Object |
remove(Object key)
|
int |
size()
|
long |
syncFailures()
Return the number of synchronization failures for read-only operations |
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 |
| Field Detail |
|---|
protected final Map c_
protected final Sync rd_
protected final Sync wr_
protected final SynchronizedLong syncFailures_
| Constructor Detail |
|---|
public SyncMap(Map map,
Sync sync)
public SyncMap(Map map,
ReadWriteLock rwl)
public SyncMap(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 MaphashCode in class Objectpublic boolean equals(Object o)
equals in interface Mapequals in class Objectpublic int size()
size in interface Mappublic boolean isEmpty()
isEmpty in interface Mappublic boolean containsKey(Object o)
containsKey in interface Mappublic boolean containsValue(Object o)
containsValue in interface Mappublic Object get(Object key)
get in interface Map
public Object put(Object key,
Object value)
put in interface Mappublic Object remove(Object key)
remove in interface Mappublic void putAll(Map coll)
putAll in interface Mappublic void clear()
clear in interface Mappublic Set keySet()
keySet in interface Mappublic Set entrySet()
entrySet in interface Mappublic Collection values()
values in interface Map
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||