com.xavax.xstore.util
Interface Pool

All Known Implementing Classes:
AbstractPool

public interface Pool

Pool defines the interface for a pool of resources.


Method Summary
 boolean active()
          Returns true if this pool is active.
 Object allocate(boolean waitFlag)
          Allocate a resource from the pool.
 int available()
          Return the number of available resources.
 void release(Object o)
          Release a resource and return it to the pool.
 void start()
          Start allocating resources.
 void stop()
          Stop allocating resources.
 

Method Detail

active

public boolean active()
Returns true if this pool is active. An inactive pool will refuse allocate a resource regardless of whether resources are available.

Returns:
true if this pool is active.

allocate

public Object allocate(boolean waitFlag)
Allocate a resource from the pool. If no resources are available, and the pool is already at maximum size and waitFlag is true, then wait until a resource is available; otherwise return null.

Parameters:
waitFlag - true if method should wait for an available resource.
Returns:
a resource, or null if not are available.

available

public int available()
Return the number of available resources.

Returns:
the number of available resources.

release

public void release(Object o)
Release a resource and return it to the pool.

Parameters:
o - the resource to be released.

start

public void start()
Start allocating resources.


stop

public void stop()
Stop allocating resources.