Top Description Fields Constructors Methods
stormpot

pack-priv Class OrExpiration<T extends Poolable>

extends Object
implements Expiration<T extends Poolable>
Class Inheritance
All Implemented Interfaces
stormpot.Expiration
Imports
java.util.concurrent.TimeUnit

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 (Expiration#after(long, TimeUnit)) and some other criteria.
Author
Guillaume Lederrey
Since
2.4

Field Summary

Modifier and TypeField and Description
private final Expiration<T>
private final Expiration<T>

Constructor Summary

AccessConstructor and Description
pack-priv
OrExpiration(Expiration<T> firstExpiration, Expiration<T> secondExpiration)

Method Summary

Modifier and TypeMethod and Description
public boolean
hasExpired(SlotInfo<? extends T>
An informative representative of the slot being tested. Never `null`.
info
)

Implements stormpot.Expiration.hasExpired.

Returns `true` if any of the given Expiration has expired.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

firstExpirationback to summary
private final Expiration<T> firstExpiration
secondExpirationback to summary
private final Expiration<T> secondExpiration

Constructor Detail

OrExpirationback to summary
pack-priv OrExpiration(Expiration<T> firstExpiration, Expiration<T> secondExpiration)

Method Detail

hasExpiredback to summary
public boolean hasExpired(SlotInfo<? extends T> info) throws Exception

Implements stormpot.Expiration.hasExpired.

Returns `true` if any of the given Expiration has expired.

Parameters
info:SlotInfo<? extends T>

Doc from stormpot.Expiration.hasExpired.

An informative representative of the slot being tested. Never `null`.

Returns:boolean

Doc from stormpot.Expiration.hasExpired.

`true` if the Slot and Poolable in question should be deallocated, `false` if it is valid and eligible for claiming.

Annotations
@Override
Exceptions
Exception:

Doc from stormpot.Expiration.hasExpired.

If checking the validity of the Slot or Poolable somehow went wrong. In this case, the Poolable will be assumed to be expired.