|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface PoolableObject
An object that is able of being recycled and stored in an object pool. This object must support:
finalize
method, this object must call its objectPool
and invoke method
returnToPool
on it. In this way, the object pool will contain
a reference to this
, making this object strongly reachable
(see Java reference for explanation) after finalization and consequently
making this object resurrected.
clear
method. This method must force the object into the same state
that it achieved during construction. Since object pools are mainly used for data
holder objects, this would imply a reset of all data fields to their default values.
setObjectPool
when the object is instantiated by the pool automatically,
OR must be set by hand when the object is constructed manually.
Note that object pools are mostly usable for simple data holder objects, which are created in great amounts and are also frequently released. This means that the receivers of these objects simply inspect some values (or even do nothing), after which they have no more use for the object and do not store it in some sort of data container structure.
Method Summary | |
---|---|
void |
clear()
Clears the contents (data fields) of this object by resetting them to the uninitialized (after construction) values. |
void |
setObjectPool(ObjectPool pool)
Sets the object pool to which this object belongs. |
Method Detail |
---|
void clear()
void setObjectPool(ObjectPool pool)
pool
- the pool to which this object will return
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |