org.apache.openjpa.lib.util.concurrent
Class ConcurrentReferenceHashSet<E>

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

public class ConcurrentReferenceHashSet<E>
extends Object
implements Set<E>, 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(E obj)
           
 boolean addAll(Collection<? extends E> coll)
           
 void clear()
           
 boolean contains(Object obj)
           
 boolean containsAll(Collection<?> coll)
           
 boolean equals(Object obj)
           
 int hashCode()
           
 boolean isEmpty()
           
 Iterator<E> iterator()
           
 boolean remove(Object obj)
           
 boolean removeAll(Collection<?> coll)
           
 boolean retainAll(Collection<?> coll)
           
 int size()
           
 Object[] toArray()
           
<T> T[]
toArray(T[] 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(E obj)
Specified by:
add in interface Collection<E>
Specified by:
add in interface Set<E>

addAll

public boolean addAll(Collection<? extends E> coll)
Specified by:
addAll in interface Collection<E>
Specified by:
addAll in interface Set<E>

clear

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

contains

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

containsAll

public boolean containsAll(Collection<?> coll)
Specified by:
containsAll in interface Collection<E>
Specified by:
containsAll in interface Set<E>

isEmpty

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

iterator

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

remove

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

removeAll

public boolean removeAll(Collection<?> coll)
Specified by:
removeAll in interface Collection<E>
Specified by:
removeAll in interface Set<E>

retainAll

public boolean retainAll(Collection<?> coll)
Specified by:
retainAll in interface Collection<E>
Specified by:
retainAll in interface Set<E>

size

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

toArray

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

toArray

public <T> T[] toArray(T[] arr)
Specified by:
toArray in interface Collection<E>
Specified by:
toArray in interface Set<E>

hashCode

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

equals

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


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