public class TimeExpiration<T extends Poolable> extends Object implements Expiration<T>
This is a time based Expiration. It will invalidate
objects based on how long ago they were allocated.
| Constructor and Description |
|---|
TimeExpiration(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.
|
public TimeExpiration(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.
If the maxPermittedAge is less than one, or the unit is null, then
an IllegalArgumentException will be thrown.
maxPermittedAge - Poolables older than this, in the given unit, will
be considered expired. This value must be at least 1.unit - The TimeUnit of the maximum permitted age. Never
null.public boolean hasExpired(SlotInfo<? extends T> info)
Returns true if the Poolable represented by the given
SlotInfo is older than the maximum age permitted by this
TimeExpiration.
hasExpired in interface Expiration<T extends Poolable>info - An informative representative of the slot being tested.
Never null.true if the Slot and Poolable in question should be
deallocated, false if it is valid and eligible for claiming.Copyright © 2011-2014–2015. All rights reserved.