|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.globus.cog.util.DeferredCommitHashSet
public class DeferredCommitHashSet
A synchronized implementation of Set which allows deferred modifications.
The set can be locked/unlocked using the lock and unlock methods. If
any of the add, remove, addAll, or removeAll
methods are called while the set is locked, their effect is deferred until the
set is unlocked. In other words, if an iteration is performed while the set is
locked, modification of the set by either the thread performing the iteration
or another thread, will not cause the iterator to throw a
ConcurrentModificationException. Instead, the modifications of the set
will only take effect when the set is unlocked.
Read operations, including size, contains, equals,
hashSet, will not change while the set is locked. This behaviour breaks
the general semantics of a set. For example, the following method will return
false:
public boolean foo() {
set.lock();
try {
set.add("a");
return set.contains("a");
}
finally {
set.unlock();
}
}
The implementation also uses lazy object instantiation, making it suitable for
cases where the set is likely to remain empty over its lifetime.
Access to the set is internally synchronized.
Constructor Summary | |
---|---|
DeferredCommitHashSet()
Deprecated. |
Method Summary | |
---|---|
boolean |
add(Object o)
Deprecated. |
boolean |
addAll(Collection c)
Deprecated. |
void |
clear()
Deprecated. |
boolean |
contains(Object o)
Deprecated. |
boolean |
containsAll(Collection c)
Deprecated. |
boolean |
equals(Object obj)
Deprecated. |
int |
hashCode()
Deprecated. |
boolean |
isEmpty()
Deprecated. |
Iterator |
iterator()
Deprecated. |
void |
lock()
Deprecated. |
boolean |
remove(Object o)
Deprecated. |
boolean |
removeAll(Collection c)
Deprecated. |
boolean |
retainAll(Collection c)
Deprecated. |
int |
size()
Deprecated. |
Object[] |
toArray()
Deprecated. |
Object[] |
toArray(Object[] type)
Deprecated. |
String |
toString()
Deprecated. |
void |
unlock()
Deprecated. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public DeferredCommitHashSet()
Method Detail |
---|
public int size()
size
in interface Collection
size
in interface Set
public boolean isEmpty()
isEmpty
in interface Collection
isEmpty
in interface Set
public boolean contains(Object o)
contains
in interface Collection
contains
in interface Set
public Iterator iterator()
iterator
in interface Iterable
iterator
in interface Collection
iterator
in interface Set
public Object[] toArray()
toArray
in interface Collection
toArray
in interface Set
public Object[] toArray(Object[] type)
toArray
in interface Collection
toArray
in interface Set
public boolean add(Object o)
add
in interface Collection
add
in interface Set
public boolean remove(Object o)
remove
in interface Collection
remove
in interface Set
public boolean containsAll(Collection c)
containsAll
in interface Collection
containsAll
in interface Set
public boolean addAll(Collection c)
addAll
in interface Collection
addAll
in interface Set
public boolean retainAll(Collection c)
retainAll
in interface Collection
retainAll
in interface Set
public boolean removeAll(Collection c)
removeAll
in interface Collection
removeAll
in interface Set
public void clear()
clear
in interface Collection
clear
in interface Set
public void lock()
public void unlock()
public boolean equals(Object obj)
equals
in interface Collection
equals
in interface Set
equals
in class Object
public int hashCode()
hashCode
in interface Collection
hashCode
in interface Set
hashCode
in class Object
public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |