Interface ObjectPoolHandler<T>
public interface ObjectPoolHandler<T>
-
Method Summary
Modifier and TypeMethodDescriptionvoid
disposeObject
(T object) Disposes the object.Makes a new instance of the pooled object.void
shutdown()
Releases any allocated resources.void
testObject
(T object) Tests the borrowed object.validate
(ObjectPoolConfiguration original) Validates, copies and updates the originalObjectPoolConfiguration
.
-
Method Details
-
validate
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
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
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.
-