|
SolarMetric Kodo JDO 2.5.8 generated on January 11 2004 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--serp.util.AbstractPool
Abstract generic pool implementation. Subclasses must implement the
freeCollection()
and takenMap()
methods to return mutable
views of the free and taken pool instances, respectively.
This implementation is not synchronized.
Constructor Summary | |
AbstractPool()
Deprecated. Construct an empty pool with min, max, wait, autoReturn
properties of 0. |
|
AbstractPool(Collection c)
Deprecated. Construct a pool initialized with the given collection of free instances. |
|
AbstractPool(int min,
int max,
int wait,
int autoReturn)
Deprecated. Construct a pool with the given properties. |
Method Summary | |
boolean |
add(Object obj)
Deprecated. |
boolean |
addAll(Collection c)
Deprecated. |
protected void |
clean()
Deprecated. Returns expired taken objects to the pool, and removes any null entries from the taken set (can occur if the taken set map does not hold strong references to its entries). |
void |
clear()
Deprecated. |
boolean |
contains(Object obj)
Deprecated. |
boolean |
containsAll(Collection c)
Deprecated. |
protected Object |
create(Object match)
Deprecated. Return a new pool element matching the given criteria passed to the get(Object,Comparator) method. |
boolean |
equals(Object obj)
Deprecated. Pool equality should be implemented to compare the free elements of the pool. |
protected Object |
find(Object match,
Comparator comp)
Deprecated. Locates a pooled object that matches the given instance according to the given comparator. |
protected void |
free(Object obj)
Deprecated. Free the resources taken by the given pool element. |
protected abstract Collection |
freeCollection()
Deprecated. Provide a modifiable view of the free pool instances. |
Object |
get()
Deprecated. Return a free object from the pool. |
Object |
get(Object match)
Deprecated. Return a free object from the pool that compares true using Object.equals(java.lang.Object) to the given instance. |
Object |
get(Object match,
Comparator comp)
Deprecated. Return a free object matching from the pool. |
int |
getAutoReturn()
Deprecated. Return the maximum number of milliseconds a pooled item can be taken before it is automatically returned to the pool. |
int |
getMaxPool()
Deprecated. Return the maximum number of pooled items, including taken instances. |
int |
getMinPool()
Deprecated. Return the minimum number of pooled items, including taken instances. |
int |
getWait()
Deprecated. Return the maximum number of milliseconds the get() method will
wait for a free pool item. |
int |
hashCode()
Deprecated. The hash code should be implemented to be consistent with equality. |
boolean |
isEmpty()
Deprecated. |
protected boolean |
isValid(Object obj)
Deprecated. Return false if the given pool element is no longer valid. |
Iterator |
iterator()
Deprecated. Returns an iterator over the free elements of the pool. |
boolean |
remove(Object obj)
Deprecated. |
boolean |
removeAll(Collection c)
Deprecated. |
boolean |
retainAll(Collection c)
Deprecated. |
void |
setAutoReturn(int millis)
Deprecated. Return the maximum number of milliseconds a pooled item can be taken before it is automatically returned to the pool. |
void |
setMaxPool(int max)
Deprecated. Set the maximum number of pooled items, including taken instances. |
void |
setMinPool(int min)
Deprecated. Set the minimum number of pooled items, including taken instances. |
void |
setWait(int millis)
Deprecated. Set the maximum number of milliseconds the get() method will
wait for a free pool item. |
int |
size()
Deprecated. |
protected abstract Map |
takenMap()
Deprecated. Provide a modifiable map view of the taken pool instances. |
Set |
takenSet()
Deprecated. Return a read-only view of the set of taken instances. |
Object[] |
toArray()
Deprecated. |
Object[] |
toArray(Object[] fill)
Deprecated. |
Methods inherited from class java.lang.Object |
|
Constructor Detail |
public AbstractPool()
min, max, wait, autoReturn
properties of 0.public AbstractPool(int min, int max, int wait, int autoReturn)
min
- the minimum pool size, including taken instancesmax
- the maximum pool size, including taken instanceswait
- the maximum number of milliseconds to wait for a
free instanceautoReturn
- the number of milliseconds after which taken
instances can be automatically reclaimedpublic AbstractPool(Collection c)
Method Detail |
public int getMaxPool()
Pool
getMaxPool
in interface Pool
public void setMaxPool(int max)
Pool
Collection.add(java.lang.Object)
operations will return false until the maximum
is met.setMaxPool
in interface Pool
public int getMinPool()
Pool
Collection.remove(java.lang.Object)
methods may fail if the size would be trimmed
to under the minimum value.getMinPool
in interface Pool
public void setMinPool(int min)
Pool
Collection.remove(java.lang.Object)
operations may fail if the constraint would be
violated. However, the Collection.clear()
operation will always
succeed.setMinPool
in interface Pool
public int getWait()
Pool
Pool.get()
method will
wait for a free pool item. This property defaults to 0.getWait
in interface Pool
public void setWait(int millis)
Pool
Pool.get()
method will
wait for a free pool item. This property defaults to 0.setWait
in interface Pool
public int getAutoReturn()
Pool
getAutoReturn
in interface Pool
public void setAutoReturn(int millis)
Pool
setAutoReturn
in interface Pool
public Iterator iterator()
Pool
Iterator.remove()
remove method may throw an
IllegalStateException
if removing an element would
violoate the minimum pool size.iterator
in interface Pool
public int size()
size
in interface Set
public boolean isEmpty()
isEmpty
in interface Set
public boolean contains(Object obj)
contains
in interface Set
public boolean containsAll(Collection c)
containsAll
in interface Set
public Object[] toArray()
toArray
in interface Set
public Object[] toArray(Object[] fill)
toArray
in interface Set
public boolean add(Object obj)
add
in interface Set
public boolean addAll(Collection c)
addAll
in interface Set
public boolean remove(Object obj)
remove
in interface Set
public boolean removeAll(Collection c)
removeAll
in interface Set
public boolean retainAll(Collection c)
retainAll
in interface Set
public void clear()
clear
in interface Set
public boolean equals(Object obj)
Pool
equals
in interface Pool
equals
in class Object
public int hashCode()
Pool
hashCode
in interface Pool
hashCode
in class Object
public Object get()
get
in interface Pool
get(Object,Comparator)
public Object get(Object match)
Object.equals(java.lang.Object)
to the given instance.get
in interface Pool
get(Object,Comparator)
public Object get(Object match, Comparator comp)
Comparator
. All
other get
methods are implemented in terms of this version.get
in interface Pool
match
- the object to compare to; may be nullcomp
- the comparator to use; if null and match
is null, any object will match; if null and
match
is not null,
matching will be based on the Object.equals(java.lang.Object)
methodNoSuchElementException
- if no matching object can be
obtained in the set wait periodpublic Set takenSet()
Pool
takenSet
in interface Pool
protected Object find(Object match, Comparator comp)
get()
to find matching instances. The pool
is first cleaned via the clean()
method, then if the
free set has any elements in it, it is iterated to find a matching
instance. Before returning any matches the taken object is placed
in the taken set along with the current time.protected void clean()
protected abstract Collection freeCollection()
protected abstract Map takenMap()
Long
value representing the millisecond
time at which the key was taken. Implementations are free to use
weak mappings.protected boolean isValid(Object obj)
protected void free(Object obj)
protected Object create(Object match)
get(Object,Comparator)
method. If auto-creation is
not supported, return null. Returns null by default.
|
SolarMetric Kodo JDO 2.5.8 generated on January 11 2004 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |