- java.lang.Object
-
- stormpot.BasePoolable
-
-
Constructor Summary
Constructors Constructor Description BasePoolable(Slot slot)
Build aBasePoolable
for the given slot.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
expire()
Explicitly expire this object, such that it will not be claimed again once it is released.void
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.
-
-
-
Field Detail
-
slot
protected final Slot slot
The
Slot
representing this objects place in the pool. The slot is also the facade for client code toexplicitly expire
this object, and torelease
this object back to the pool.
-
-
Method Detail
-
release
public void release()
Description copied from interface:Poolable
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!
-
expire
public void expire()
Explicitly expire this object, such that it will not be claimed again once it is released.
- See Also:
Slot.expire(Poolable)
-
-