org.globus.cog.util
Class DeferredCommitHashSet

java.lang.Object
  extended by org.globus.cog.util.DeferredCommitHashSet
All Implemented Interfaces:
Iterable, Collection, Set

Deprecated. The scheme used in the implementation of this class can cause the commits to never or rarely occur if the set is locked from multiple threads but never or ralely unlocked simultaneousely

public class DeferredCommitHashSet
extends Object
implements Set

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

DeferredCommitHashSet

public DeferredCommitHashSet()
Deprecated. 
Method Detail

size

public int size()
Deprecated. 
Specified by:
size in interface Collection
Specified by:
size in interface Set

isEmpty

public boolean isEmpty()
Deprecated. 
Specified by:
isEmpty in interface Collection
Specified by:
isEmpty in interface Set

contains

public boolean contains(Object o)
Deprecated. 
Specified by:
contains in interface Collection
Specified by:
contains in interface Set

iterator

public Iterator iterator()
Deprecated. 
Specified by:
iterator in interface Iterable
Specified by:
iterator in interface Collection
Specified by:
iterator in interface Set

toArray

public Object[] toArray()
Deprecated. 
Specified by:
toArray in interface Collection
Specified by:
toArray in interface Set

toArray

public Object[] toArray(Object[] type)
Deprecated. 
Specified by:
toArray in interface Collection
Specified by:
toArray in interface Set

add

public boolean add(Object o)
Deprecated. 
Specified by:
add in interface Collection
Specified by:
add in interface Set

remove

public boolean remove(Object o)
Deprecated. 
Specified by:
remove in interface Collection
Specified by:
remove in interface Set

containsAll

public boolean containsAll(Collection c)
Deprecated. 
Specified by:
containsAll in interface Collection
Specified by:
containsAll in interface Set

addAll

public boolean addAll(Collection c)
Deprecated. 
Specified by:
addAll in interface Collection
Specified by:
addAll in interface Set

retainAll

public boolean retainAll(Collection c)
Deprecated. 
Specified by:
retainAll in interface Collection
Specified by:
retainAll in interface Set

removeAll

public boolean removeAll(Collection c)
Deprecated. 
Specified by:
removeAll in interface Collection
Specified by:
removeAll in interface Set

clear

public void clear()
Deprecated. 
Specified by:
clear in interface Collection
Specified by:
clear in interface Set

lock

public void lock()
Deprecated. 

unlock

public void unlock()
Deprecated. 

equals

public boolean equals(Object obj)
Deprecated. 
Specified by:
equals in interface Collection
Specified by:
equals in interface Set
Overrides:
equals in class Object

hashCode

public int hashCode()
Deprecated. 
Specified by:
hashCode in interface Collection
Specified by:
hashCode in interface Set
Overrides:
hashCode in class Object

toString

public String toString()
Deprecated. 
Overrides:
toString in class Object