|
||||||||||
| 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 Collectionsize in interface Setpublic boolean isEmpty()
isEmpty in interface CollectionisEmpty in interface Setpublic boolean contains(Object o)
contains in interface Collectioncontains in interface Setpublic Iterator iterator()
iterator in interface Iterableiterator in interface Collectioniterator in interface Setpublic Object[] toArray()
toArray in interface CollectiontoArray in interface Setpublic Object[] toArray(Object[] type)
toArray in interface CollectiontoArray in interface Setpublic boolean add(Object o)
add in interface Collectionadd in interface Setpublic boolean remove(Object o)
remove in interface Collectionremove in interface Setpublic boolean containsAll(Collection c)
containsAll in interface CollectioncontainsAll in interface Setpublic boolean addAll(Collection c)
addAll in interface CollectionaddAll in interface Setpublic boolean retainAll(Collection c)
retainAll in interface CollectionretainAll in interface Setpublic boolean removeAll(Collection c)
removeAll in interface CollectionremoveAll in interface Setpublic void clear()
clear in interface Collectionclear in interface Setpublic void lock()
public void unlock()
public boolean equals(Object obj)
equals in interface Collectionequals in interface Setequals in class Objectpublic int hashCode()
hashCode in interface CollectionhashCode in interface SethashCode in class Objectpublic String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||