Package EDU.oswego.cs.dl.util.concurrent
Class SyncSet
- java.lang.Object
-
- EDU.oswego.cs.dl.util.concurrent.SyncCollection
-
- EDU.oswego.cs.dl.util.concurrent.SyncSet
-
- All Implemented Interfaces:
java.lang.Iterable
,java.util.Collection
,java.util.Set
- Direct Known Subclasses:
SyncSortedSet
public class SyncSet extends SyncCollection implements java.util.Set
SyncSets wrap Sync-based control around java.util.Sets. They support two additional reader operations than do SyncCollection: hashCode and equals.- See Also:
SyncCollection
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class EDU.oswego.cs.dl.util.concurrent.SyncCollection
SyncCollection.SyncCollectionIterator
-
-
Field Summary
-
Fields inherited from class EDU.oswego.cs.dl.util.concurrent.SyncCollection
c_, rd_, syncFailures_, wr_
-
-
Constructor Summary
Constructors Constructor Description SyncSet(java.util.Set set, ReadWriteLock rwl)
Create a new SyncSet protecting the given set, and using the given ReadWriteLock to control reader and writer methods.SyncSet(java.util.Set set, Sync sync)
Create a new SyncSet protecting the given collection, and using the given sync to control both reader and writer methods.SyncSet(java.util.Set set, Sync readLock, Sync writeLock)
Create a new SyncSet protecting the given set, and using the given pair of locks to control reader and writer methods.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object o)
int
hashCode()
-
Methods inherited from class EDU.oswego.cs.dl.util.concurrent.SyncCollection
add, addAll, afterRead, beforeRead, clear, contains, containsAll, isEmpty, iterator, readerSync, remove, removeAll, retainAll, size, syncFailures, toArray, toArray, unprotectedIterator, writerSync
-
-
-
-
Constructor Detail
-
SyncSet
public SyncSet(java.util.Set set, Sync sync)
Create a new SyncSet protecting the given collection, and using the given sync to control both reader and writer methods. Common, reasonable choices for the sync argument include Mutex, ReentrantLock, and Semaphores initialized to 1.
-
SyncSet
public SyncSet(java.util.Set set, ReadWriteLock rwl)
Create a new SyncSet protecting the given set, and using the given ReadWriteLock to control reader and writer methods.
-
-
Method Detail
-
hashCode
public int hashCode()
- Specified by:
hashCode
in interfacejava.util.Collection
- Specified by:
hashCode
in interfacejava.util.Set
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Specified by:
equals
in interfacejava.util.Collection
- Specified by:
equals
in interfacejava.util.Set
- Overrides:
equals
in classjava.lang.Object
-
-