org.apache.openjpa.lib.util.concurrent
Class ConcurrentReferenceHashSet

java.lang.Object
  extended by org.apache.openjpa.lib.util.concurrent.ConcurrentReferenceHashSet
All Implemented Interfaces:
Serializable, Iterable, Collection, Set

public class ConcurrentReferenceHashSet
extends Object
implements Set, Serializable

A concurrent set whose values may be stored as weak or soft references. If the constructor is invoked with refType set to HARD, this uses a JDK1.5 ConcurrentHashMap under the covers. Otherwise, it uses a ConcurrentReferenceHashMap.

Author:
Abe White
See Also:
Serialized Form

Field Summary
static int HARD
          Hard reference marker.
static int SOFT
          Soft reference marker.
static int WEAK
          Weak reference marker.
 
Constructor Summary
ConcurrentReferenceHashSet(int refType)
          Construct a set with the given reference type.
 
Method Summary
 boolean add(Object obj)
           
 boolean addAll(Collection coll)
           
 void clear()
           
 boolean contains(Object obj)
           
 boolean containsAll(Collection coll)
           
 boolean equals(Object obj)
           
 int hashCode()
           
 boolean isEmpty()
           
 Iterator iterator()
           
 boolean remove(Object obj)
           
 boolean removeAll(Collection coll)
           
 boolean retainAll(Collection coll)
           
 int size()
           
 Object[] toArray()
           
 Object[] toArray(Object[] arr)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

HARD

public static final int HARD
Hard reference marker.

See Also:
Constant Field Values

SOFT

public static final int SOFT
Soft reference marker.

See Also:
Constant Field Values

WEAK

public static final int WEAK
Weak reference marker.

See Also:
Constant Field Values
Constructor Detail

ConcurrentReferenceHashSet

public ConcurrentReferenceHashSet(int refType)
Construct a set with the given reference type.

Method Detail

add

public boolean add(Object obj)
Specified by:
add in interface Collection
Specified by:
add in interface Set

addAll

public boolean addAll(Collection coll)
Specified by:
addAll in interface Collection
Specified by:
addAll in interface Set

clear

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

contains

public boolean contains(Object obj)
Specified by:
contains in interface Collection
Specified by:
contains in interface Set

containsAll

public boolean containsAll(Collection coll)
Specified by:
containsAll in interface Collection
Specified by:
containsAll in interface Set

isEmpty

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

iterator

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

remove

public boolean remove(Object obj)
Specified by:
remove in interface Collection
Specified by:
remove in interface Set

removeAll

public boolean removeAll(Collection coll)
Specified by:
removeAll in interface Collection
Specified by:
removeAll in interface Set

retainAll

public boolean retainAll(Collection coll)
Specified by:
retainAll in interface Collection
Specified by:
retainAll in interface Set

size

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

toArray

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

toArray

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

hashCode

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

equals

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


Copyright © 2006-2010 Apache Software Foundation. All Rights Reserved.