java.lang.Object
stormpot.internal.TimeExpiration<T>
- Type Parameters:
T- The concrete poolable type.
- All Implemented Interfaces:
Expiration<T>
This is a time based
Expiration. It will invalidate
objects based on how long ago they were allocated.- Author:
- Chris Vest
-
Constructor Summary
ConstructorsConstructorDescriptionTimeExpiration(long maxPermittedAge, TimeUnit unit) Construct a new Expiration that will invalidate objects that are older than the provided span of time in the given unit. -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface stormpot.Expiration
every, every, or
-
Constructor Details
-
TimeExpiration
Construct a new Expiration that will invalidate objects that are older than the provided span of time in the given unit.If the
maxPermittedAgeis less than one, or theunitisnull, then anIllegalArgumentExceptionwill be thrown.- Parameters:
maxPermittedAge- Poolables older than this, in the given unit, will be considered expired. This value must be at least 1.unit- TheTimeUnitof the maximum permitted age. Nevernull.
-
-
Method Details
-
hasExpired
Returnstrueif thePoolablerepresented by the givenSlotInfois older than the maximum age permitted by this TimeExpiration.- Specified by:
hasExpiredin interfaceExpiration<T extends Poolable>- Parameters:
info- An informative representative of the slot being tested. Nevernull.- Returns:
trueif the Slot and Poolable in question should be deallocated,falseif it is valid and eligible for claiming.
-
toString
-