Top Description Fields Constructors Methods
stormpot

pack-priv final Class TimeExpiration<T extends Poolable>

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

This is a time based Expiration. It will invalidate objects based on how long ago they were allocated.
Author
Chris Vest

Field Summary

Modifier and TypeField and Description
private final long
private final TimeUnit

Constructor Summary

AccessConstructor and Description
pack-priv
TimeExpiration(long
Poolables older than this, in the given unit, will be considered expired. This value must be at least 1.
maxPermittedAge
,
TimeUnit
The TimeUnit of the maximum permitted age. Never `null`.
unit
)

Construct a new Expiration that will invalidate objects that are older than the provided span of time in the given 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.

Returns `true` if the Poolable represented by the given SlotInfo is older than the maximum age permitted by this TimeExpiration.
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

maxPermittedAgeMillisback to summary
private final long maxPermittedAgeMillis
unitback to summary
private final TimeUnit unit

Constructor Detail

TimeExpirationback to summary
pack-priv 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.

Parameters
maxPermittedAge:long

Poolables older than this, in the given unit, will be considered expired. This value must be at least 1.

unit:TimeUnit

The TimeUnit of the maximum permitted age. Never `null`.

Method Detail

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

Implements stormpot.Expiration.hasExpired.

Returns `true` if the Poolable represented by the given SlotInfo is older than the maximum age permitted by this TimeExpiration.

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
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object

Annotations
@Override