public class CompoundExpiration<T extends Poolable> extends Object implements Expiration<T>
Provides a way to compose Expirations.
Given two Expirations, this class considers that a slot is expired if any of the
Expiration returns true. This makes it easy to have an Expiration that
expires both on time (TimeExpiration) and some other criteria.
| Constructor and Description |
|---|
CompoundExpiration(Expiration<T> firstExpiration,
Expiration<T> secondExpiration) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
hasExpired(SlotInfo<? extends T> info)
Returns
true if any of the given Expiration has expired. |
public CompoundExpiration(Expiration<T> firstExpiration, Expiration<T> secondExpiration)
public boolean hasExpired(SlotInfo<? extends T> info) throws Exception
Returns true if any of the given Expiration has expired.
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.Exception - If checking the validity of the Slot or Poolable somehow
went wrong. In this case, the Poolable will be assumed to be expired.Copyright © 2011-2014–2015. All rights reserved.