org.d_haven.mpool
Interface ManagablePool
public
interface
ManagablePool
extends Pool
This is the interface for Pools that are not a fixed size. This
interface exposes enough explicit state so that an external
asynchronous Controller can do it's job. A secondary purpose of this
interface is to supply a simple authentication mechanism so that the
Pool only responds to method invocations by the legitimate
controller.
The key is a randomly generated number greater than one assigned by
the PoolManager and given to the Pool and the PoolController. The
mechanism to generate the number is up to the PoolManager's policy.
Keep in mind that should the key be made publicly available, the Pool
is susceptible to a replay attack. Therefore, it is suggested that
the key be created at the same time the Pool is created.
Version: CVS $Revision: 1.4 $ $Date: 2004/06/21 17:03:46 $
Author: Berin Loritsch
Method Summary |
void | grow(int amount)
Grow by the specified amount. |
void | shrink(int amount)
Shrink the pool by the specified amount. |
int | size()
Determine the pool's current size. |
public void grow(int amount)
Grow by the specified amount. The pool should trust the
Controller for the Grow size.
Parameters: amount an integer amount to increase the pool size by.
public void shrink(int amount)
Shrink the pool by the specified amount. The pool should trust
the Controller, but be smart enough not to achieve a negative
pool size. In other words, you should clip the shrink amount so
that the pool does not go below 0.
Parameters: amount an integer amount to decrease the pool size by.
public int size()
Determine the pool's current size. The size is defined as the
number of Poolable objects in reserve.
Returns: size of pool's reserve.