org.objectweb.easybeans.pool
Interface Pool<InstanceType,Clue>

Type Parameters:
InstanceType - the type of the object that are managed by the pool (could be EasyBeansSLSB, etc.)
Clue - a clue to retrieve a specific instance in the pool
All Superinterfaces:
PoolAttributes
All Known Implementing Classes:
JPool

public interface Pool<InstanceType,Clue>
extends PoolAttributes

Defines a common pool interface used to manage objects.

Author:
Florent Benoit

Method Summary
 void discard(InstanceType instance)
          Discard the instance which is in the pool.
 InstanceType get()
          Gets an object from the pool.
 InstanceType get(Clue clue)
          Gets an object by using a specific hint.
 void release(InstanceType instance)
          Puts back the instance in the pool so it can be reused.
 void start()
          Start the pool.
It could create initial instances if specified.
 void stop()
          Stop this pool.
 

Method Detail

get

InstanceType get()
                 throws PoolException
Gets an object from the pool.

Returns:
an instance of an object with type Type.
Throws:
PoolException - if instance cannot be returned.

get

InstanceType get(Clue clue)
                 throws PoolException
Gets an object by using a specific hint.

Parameters:
clue - attribute used to retrieve a given instance
Returns:
a specific instance of the resource.
Throws:
PoolException - if instance cannot be returned.

release

void release(InstanceType instance)
             throws PoolException
Puts back the instance in the pool so it can be reused.

Parameters:
instance - which will be put back in the pool.
Throws:
PoolException - if instance is not released.

discard

void discard(InstanceType instance)
Discard the instance which is in the pool.

Parameters:
instance - which will be discarded.

start

void start()
           throws PoolException
Start the pool.
It could create initial instances if specified.

Throws:
PoolException - if initialization fails

stop

void stop()
          throws PoolException
Stop this pool.

Throws:
PoolException - if destroy fails