Enum Class ReclaimAction
- All Implemented Interfaces:
Serializable,Comparable<ReclaimAction>,java.lang.constant.Constable
The possible actions that can be taken when a
GenericObjectPool
decides that it is time to reclaim an object from a burrower, e.g. because
the maximum lease time expired or the object is considered abandoned.- Author:
- Patrick Schmidt
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionAnother form of reclaiming: not the object itself is reclaimed but rather the resources.Do nothing.reclaim the object; may cause problems if wrapping is not enabled since the previous burrower may still have a reference to the object.This is sort of meta-action, a combination ofRECLAIM_OBJECTandDESTROY_OBJECT.Simply release the object from the pool without destroying it. -
Method Summary
Modifier and TypeMethodDescriptionstatic ReclaimActionReturns the enum constant of this class with the specified name.static ReclaimAction[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
NO_ACTION
Do nothing. This is only useful in combination with aObjectPoolListenerthat logs such errors. (When objects aren't properly checked in, this is basically an error and reclaiming them is a form of error handling.)Please be aware, that if nothing is done and enough objects aren't returned to the pool, at some point, the pool will become exhausted and bring the whole system to a halt; at least those parts, that use the pool.
-
RECLAIM_OBJECT
reclaim the object; may cause problems if wrapping is not enabled since the previous burrower may still have a reference to the object. I.e. he may still use the object or even return it to the pool! -
DESTROY_OBJECT
Another form of reclaiming: not the object itself is reclaimed but rather the resources. The resources are released by destroying the object, so they can be required for a new object. This will free up a slot. -
RECLAIM_OR_DESTROY_OBJECT
This is sort of meta-action, a combination ofRECLAIM_OBJECTandDESTROY_OBJECT. The first will be chosen if wrapping is enabled, the second if not. Both will free up a slot. -
RELEASE_OBJECT
Simply release the object from the pool without destroying it. This does not reclaim the object or any resources, but it will free up one slot.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-