-
- All Known Implementing Classes:
ByteArrayManager,ByteBufferManager
public interface ObjectManager<T>A manager for objects which support pooling.- Author:
- Philipp Meinen
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleancanReuse(T value)Tcreate()booleanprepareForRecycle(T value)Prepare an object to be reused by a different user.voidrelease(T value)
-
-
-
Method Detail
-
create
T create()
-
release
void release(T value)
-
prepareForRecycle
boolean prepareForRecycle(T value)
Prepare an object to be reused by a different user. Implementations of this method must make sure that any data from previous users is cleared.- Parameters:
value- The object which must be prepared for reuse.- Returns:
trueif this object can be reused,falseotherwise (for example if the size of the offered buffer is too small). After returningfalserelease(Object)will be called.
-
canReuse
boolean canReuse(T value)
- Parameters:
value- -- Returns:
trueif this pooled object can be reused,falseotherwise. Example: The pooled object is a database connection which might not be reusable because the connection was closed while being in the pool.
-
-