|
J avolution v3.7 (J2SE 1.5+) | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjavolution.realtime.ObjectPool<T>
public abstract class ObjectPool<T>
This abstract class represents an object pool managed by a
PoolContext.
Pool objects are always allocated in the same memory area as the pool
object itself. In other words, NoHeapRealtimeThread
executing in ScopedMemory can safely use pools allocated in
ImmortalMemory.
| Field Summary | |
|---|---|
static ObjectPool |
NULL
Holds a pool returning null values. |
| Constructor Summary | |
|---|---|
protected |
ObjectPool()
Default constructor. |
| Method Summary | |
|---|---|
protected abstract void |
clearAll()
Removes all objects (used and new) from this pool. |
ObjectPool<T> |
getOuter()
Returns the outer pool of this pool. |
java.lang.Thread |
getUser()
Returns the current user of this pool or null if none. |
boolean |
inUse()
Indicates if this pool is in use. |
boolean |
isLocal()
Indicates if this pool is actively used by the current thread. |
abstract T |
next()
Returns the next available object from this pool. |
abstract void |
recycle(T obj)
Recycles the specified object. |
protected abstract void |
recycleAll()
Recycles all the objects of this pool (all used objects become new). |
abstract int |
size()
Returns the number of objects held by this pool. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final ObjectPool NULL
null values.
| Constructor Detail |
|---|
protected ObjectPool()
| Method Detail |
|---|
public final java.lang.Thread getUser()
null if none.
public final boolean isLocal()
true if this pool is local for the current thread;
false otherwise.
javolution.JavolutionError - if this operation is called upon a pool
not currently in use.public final boolean inUse()
true if at least one thread has been allocating from
this pool; false if this pool is not being used at
all (e.g. inner pool).public final ObjectPool<T> getOuter()
null if the outer is the heap.public abstract int size()
public abstract T next()
public abstract void recycle(T obj)
obj - the object to recycle to this pool.
java.lang.IllegalArgumentException - if the specified object do not belong
to the pool.protected abstract void recycleAll()
Note: This method is called upon exit
of a pool context for which this pool has been used.
protected abstract void clearAll()
Note: This method is called upon clearing of the pool context this pool belongs to.
|
J avolution v3.7 (J2SE 1.5+) | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||