|
JADE v6.1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.dautelle.realtime.ObjectPool
This abstract class represents an object pool managed by a
PoolContext
. Local
pools are safe to use
without synchronization. The real-time framework guarantees that
no more than one thread can have access to any local pool at any
given time. As for operations upon non-local pools, synchronization
has to be performed on the pool itself to guarantee thread-safety.
Field Summary | |
protected static int |
DEFAULT_POOL_SIZE
Holds the default pool size ( 32 ). |
Constructor Summary | |
protected |
ObjectPool()
Default constructor. |
Method Summary | |
protected abstract void |
clearAll()
Removes all objects from this pool. |
abstract void |
export(java.lang.Object obj)
Exports the specified object out of this pool to the outer pool. |
ObjectPool |
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 java.lang.Object |
next()
Returns the next available object from this pool. |
abstract void |
recycle(java.lang.Object obj)
Recycles the specified object. |
protected abstract void |
recycleAll()
Recycles all the objects of this pool. |
abstract void |
remove(java.lang.Object obj)
Removes the specified object from this pool. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected static final int DEFAULT_POOL_SIZE
32
).
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.
java.lang.IllegalAccessError
- 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 getOuter()
null
if the outer is the heap.public abstract java.lang.Object next()
public abstract void recycle(java.lang.Object obj)
obj
- the object to recycle to this pool.
java.lang.IllegalArgumentException
- if the specified object do not belong
to the pool.public abstract void export(java.lang.Object obj)
obj
- the object to export to outer pool.
java.lang.IllegalArgumentException
- if the specified object do not belong
to the pool.public abstract void remove(java.lang.Object obj)
obj
- the object to remove from 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.
|
JADE v6.1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |