Enum ReclaimAction
- java.lang.Object
-
- java.lang.Enum<ReclaimAction>
-
- de.aristaflow.adept2.util.objectpool.generic.ReclaimAction
-
- All Implemented Interfaces:
Serializable
,Comparable<ReclaimAction>
public enum ReclaimAction extends Enum<ReclaimAction>
The possible actions that can be taken when aGenericObjectPool
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
-
-
Enum Constant Summary
Enum Constants Enum Constant Description DESTROY_OBJECT
Another form of reclaiming: not the object itself is reclaimed but rather the resources.NO_ACTION
Do nothing.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.RECLAIM_OR_DESTROY_OBJECT
This is sort of meta-action, a combination ofRECLAIM_OBJECT
andDESTROY_OBJECT
.RELEASE_OBJECT
Simply release the object from the pool without destroying it.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static ReclaimAction
valueOf(String name)
Returns the enum constant of this type with the specified name.static ReclaimAction[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
NO_ACTION
public static final ReclaimAction NO_ACTION
Do nothing. This is only useful in combination with aObjectPoolListener
that 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
public static final ReclaimAction 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
public static final ReclaimAction 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
public static final ReclaimAction RECLAIM_OR_DESTROY_OBJECT
This is sort of meta-action, a combination ofRECLAIM_OBJECT
andDESTROY_OBJECT
. The first will be chosen if wrapping is enabled, the second if not. Both will free up a slot.
-
RELEASE_OBJECT
public static final ReclaimAction 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 Detail
-
values
public static ReclaimAction[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (ReclaimAction c : ReclaimAction.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static ReclaimAction valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (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 type has no constant with the specified nameNullPointerException
- if the argument is null
-
-