Interface ObjectPoolHandler<T>
-
public interface ObjectPoolHandler<T>
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
disposeObject(T object)
Disposes the object.T
makeObject()
Makes a new instance of the pooled object.void
shutdown()
Releases any allocated resources.void
testObject(T object)
Tests the borrowed object.ObjectPoolConfiguration
validate(ObjectPoolConfiguration original)
Validates, copies and updates the originalObjectPoolConfiguration
.
-
-
-
Method Detail
-
validate
ObjectPoolConfiguration validate(ObjectPoolConfiguration original)
Validates, copies and updates the originalObjectPoolConfiguration
. This class can validate and if necessary it changes theoriginal
configuration.- Parameters:
original
- custom configured instance.- Returns:
- new instance of the
original
config.
-
makeObject
T makeObject()
Makes a new instance of the pooled object. This method is called whenever a new instance is needed.- Returns:
- new instance of T.
-
testObject
void testObject(T object)
Tests the borrowed object. This method is invoked on head instances to make sure they can be borrowed from the pool.- Parameters:
object
- the pooled object.
-
disposeObject
void disposeObject(T object)
Disposes the object. This method is invoked on every instance when it is being "dropped" from the pool (whether due to the response fromtestObject(Object)
, or for reasons specific to the pool implementation.)- Parameters:
object
- The "dropped" object.
-
shutdown
void shutdown()
Releases any allocated resources. Existing active objects will remain alive and be allowed to shutdown gracefully, but no more objects will be allocated.
-
-