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

Type Parameters:
InstanceType - the type of the object that are managed by the pool (could be EasyBeansSLSB, etc.)
Clue - a clue which is given to match an instance in the pool
All Known Implementing Classes:
MDBFactory, MDBMessageEndPointFactory, StatefulSessionFactory, StatelessSessionFactory

public interface PoolFactory<InstanceType,Clue>

Allows to call specific methods for each implementation of the pool for each lifecycle on an object.

Author:
Florent Benoitt

Method Summary
 InstanceType create(Clue clue)
          Creates an instance with the given hint.
 boolean isMatching(InstanceType object, Clue clue)
          Checks if the given object with the given clue is matching.
 void remove(InstanceType object)
          Callback called when object is gonna be removed.
 boolean validate(InstanceType object, PoolEntryStatistics stats)
          Validate an instance by giving some statistics.
 

Method Detail

create

InstanceType create(Clue clue)
                    throws PoolException
Creates an instance with the given hint.

Parameters:
clue - a clue given by the Pool. Could be null.
Returns:
the created instance.
Throws:
PoolException - if instance cannot be created.

isMatching

boolean isMatching(InstanceType object,
                   Clue clue)
Checks if the given object with the given clue is matching.

Parameters:
object - given object against which the check should be done.
clue - the object used as clue to check the matching.
Returns:
true if it is matching, else false.

validate

boolean validate(InstanceType object,
                 PoolEntryStatistics stats)
Validate an instance by giving some statistics.

Parameters:
object - the instance to validate
stats - some statistics to help in the validating process.
Returns:
true if the element is valid, else false.

remove

void remove(InstanceType object)
Callback called when object is gonna be removed.

Parameters:
object - that is being removed from the pool.