stormpot
Interface Expiration<T extends Poolable>

All Known Implementing Classes:
TimeExpiration

public interface Expiration<T extends Poolable>

The expiration is used to determine if a given slot has expired, or otherwise become invalid.

Note that Expiration instances must be thread-safe, as they may be accessed concurrently by multiple threads – even for the same SlotInfo and Poolable instances. The easiest way to ensure this, is to make sure that they never mutate any state. If they do, however, then they must do so in a thread-safe manner. Be aware that making the hasExpired method synchronised will most likely severely reduce the performance and scalability of the pool.

Author:
Chris Vest <[email protected]>

Method Summary
 boolean hasExpired(SlotInfo<? extends T> info)
          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.
 

Method Detail

hasExpired

boolean hasExpired(SlotInfo<? extends T> info)
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. How pools otherwise handle the exception - if it will bubble out, and if so, where - is implementation specific. For this reason, it is generally advised that Expirations do not throw exceptions.

Parameters:
info - An informative representative of the slot being tested. Never null.
Returns:
true if the slot and poolable in question should be deallocated, false if it is valid and elegible for claiming.


Copyright © 2013. All Rights Reserved.