Top Description Methods
stormpot

public Interface SlotInfo<T extends Poolable>

Known Direct Implementers
stormpot.BSlotColdFields
Type Parameters
<T>
The type of Poolables that this Expiration is able to examine.

An informative interface, used by Expiration instances to determine if a slot has expired or is still invalid for claiming.
Author
Chris Vest

Method Summary

Modifier and TypeMethod and Description
public long

Returns:

The age of the object in milliseconds.
getAgeMillis
()

Get the approximate number of milliseconds that have transpired since the object was allocated.

public long

Returns:

The objects claim count.
getClaimCount
()

Get the number of times the object has been claimed since it was allocated.

public T

Returns:

The Poolable being examined for validity. Never `null`.
getPoolable
()

Get the Poolable object represented by this SlotInfo instance.

public long

Returns:

The current stamp value.
getStamp
()

Get the stamp value that has been set on this SlotInfo, or 0 if none has been set since the Poolable was allocated.

public void
setStamp(long
The new stamp value.
stamp
)

Set the stamp value on this SlotInfo.

Method Detail

getAgeMillisback to summary
public long getAgeMillis()

Get the approximate number of milliseconds that have transpired since the object was allocated.

Returns:long

The age of the object in milliseconds.

getClaimCountback to summary
public long getClaimCount()

Get the number of times the object has been claimed since it was allocated.

Returns:long

The objects claim count.

getPoolableback to summary
public T getPoolable()

Get the Poolable object represented by this SlotInfo instance.

Warning

Do not release() Poolables from within an Expiration — doing so is a user error, and the behaviour of the pool in such a situation is unspecified and implementation specific. This means that dead-locks and infinite loops are possible outcomes as well.

Warning

Also note that accessing the Poolable through this method, from your Expiration implementation, is a potentially concurrent access. This means that you need to take thread-safety issues into consideration - especially if you intend on manipulating the Poolable. In particular, you might be racing with other threads that are checking if this Poolable is expired or not, and they might even have claimed the Poolable and put it to use, by the time it is returned from this method.

Returns:T

The Poolable being examined for validity. Never `null`.

getStampback to summary
public long getStamp()

Get the stamp value that has been set on this SlotInfo, or 0 if none has been set since the Poolable was allocated. Apart from the zero-value, the actual meaning of this value is completely up to the Expiration that sets it.

Returns:long

The current stamp value.

setStampback to summary
public void setStamp(long stamp)

Set the stamp value on this SlotInfo. This method is only thread-safe to call from within the scope of the Expiration#hasExpired(SlotInfo) method. The stamp value is 0 by default, if it has not been set after the Poolable has been allocated. Its meaning is otherwise up to the particular Expiration that might use it.

Parameters
stamp:long

The new stamp value.