Top Fields Constructors Methods
stormpot

pack-priv final Class EveryExpiration<T extends Poolable>

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

Field Summary

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

Constructor Summary

AccessConstructor and Description
pack-priv
EveryExpiration(Expiration<T> innerExpiration, long fromTime, long toTime, TimeUnit unit)

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.

Test whether the Slot and Poolable object, represented by the given SlotInfo object, is still valid, or if the pool should deallocate it and allocate a replacement.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

innerExpirationback to summary
private final Expiration<T> innerExpiration
timeExpirationback to summary
private final TimeSpreadExpiration<T> timeExpiration

Constructor Detail

EveryExpirationback to summary
pack-priv EveryExpiration(Expiration<T> innerExpiration, long fromTime, long toTime, TimeUnit unit)

Method Detail

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

Implements stormpot.Expiration.hasExpired.

Doc from stormpot.Expiration.hasExpired.

Test whether the Slot and Poolable object, represented by the given SlotInfo object, is still valid, or if the pool should deallocate it and allocate a replacement. If the method throws an exception, then that is taken to mean that the slot is invalid. The exception will bubble out of the claim method, but the mechanism is implementation specific. For this reason, it is generally advised that Expirations do not throw exceptions. Note that this method can be called as often as several times per claim. The performance of this method therefor has a big influence on the perceived performance of the pool. If this implementation ends up being expensive, then the every-combinator can be used to construct a new expiration object that only performs the expensive check every so often.

Parameters
info:SlotInfo<? extends T>

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

Returns:boolean

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

Annotations
@Override
Exceptions
Exception:
If checking the validity of the Slot or Poolable somehow went wrong. In this case, the Poolable will be assumed to be expired.