T
- the type of objects held in this object poolpublic interface PoolObjectFactory<T>
Modifier and Type | Method and Description |
---|---|
T |
create()
Creates a new object pool's object, which is presumed to be ready (and valid) for
immediate use.
|
void |
destroy(T obj)
A method which will be called when an object from the object pool needs to be destroyed,
which may happen after a validation/initialization/passivation error or when the object
pool is shrinking its size or terminating.
|
boolean |
readyToRestore(T obj)
A validation/passivation hook which will be called when an object which has been taken
before that from the object pool is about to be restored (returned) back to the object pool.
|
boolean |
readyToTake(T obj)
A validation/initialization hook which will be called when an object from
the object pool is taken in order to be given to the calling application.
|
T create()
null
.boolean readyToTake(T obj)
true
.
If there is a particular initialization/activation which needs to be done for this object, it can be done here.
obj
- an object which is taken from the object pool and which is to be given
to the calling applicationtrue
if the validation/initialization is successful, false
otherwisereadyToRestore(Object)
boolean readyToRestore(T obj)
true
.
If there is a particular passivation which needs to be done for this object, it can be done here.
obj
- an object which has been taken before that from this object pool and which is now
to be restored to the object pooltrue
if the validation/passivation is successful, false
otherwisereadyToTake(T)
void destroy(T obj)
obj
- the object which is to be destroyedCopyright © 2013-2014 Simeon Malchev. All Rights Reserved.