Top Description Fields Constructors Methods
stormpot

public Class BasePoolable

extends Object
implements Poolable
Class Inheritance
All Implemented Interfaces
stormpot.Poolable
Known Direct Subclasses
stormpot.Pooled
Imports
java.util.Objects

A basic implementation of the Poolable interface, which can be extended directly. It is not strictly necessary to extend this class in order to implement the Poolable interface, but doing so may make your code simpler.

Field Summary

Modifier and TypeField and Description
protected final Slot
slot

The Slot representing this objects place in the pool.

Constructor Summary

AccessConstructor and Description
public
BasePoolable(Slot
The Slot that represents this objects place in the pool.
slot
)

Build a `BasePoolable` for the given slot.

Method Summary

Modifier and TypeMethod and Description
public void
expire()

Explicitly expire this object, such that it will not be claimed again once it is released.

public void
release()

Implements stormpot.Poolable.release.

Release this Poolable object back into the pool from where it came, so that others can claim it, or the pool deallocate it if it has expired.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

slotback to summary
protected final Slot slot

The Slot representing this objects place in the pool. The slot is also the facade for client code to explicitly expire this object, and to release this object back to the pool.

Constructor Detail

BasePoolableback to summary
public BasePoolable(Slot slot)

Build a `BasePoolable` for the given slot.

Parameters
slot:Slot

The Slot that represents this objects place in the pool.

Method Detail

expireback to summary
public void expire()

Explicitly expire this object, such that it will not be claimed again once it is released.

See Also
Slot#expire(Poolable)
releaseback to summary
public void release()

Implements stormpot.Poolable.release.

Doc from stormpot.Poolable.release.

Release this Poolable object back into the pool from where it came, so that others can claim it, or the pool deallocate it if it has expired. A call to this method MUST delegate to a call to Slot#release(Poolable) on the Slot object for which this Poolable was allocated, giving itself as the Poolable parameter. A Poolable can be released by a thread other than the one that claimed it. It can not, however, be released more than once per claim. The feature of permitting releases from threads other than the claiming thread might be useful in message-passing architectures and the like, but it is not generally recommendable because it makes it more complicated to keep track of object life-cycles. Great care must be taken, to ensure that Poolables are not used after they are released!

Annotations
@Override