org.ow2.util.pool.impl
Interface PoolFactory<InstanceType,Clue>

Type Parameters:
InstanceType - the type of the object that are managed by the pool (could be an EJB, JDBC connection, etc.)
Clue - a clue which is given to match an instance in the pool

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 instance, Clue clue)
          Checks if the given object with the given clue is matching.
 void remove(InstanceType instance)
          Callback called when object is gonna be removed.
 boolean validate(InstanceType instance, PoolEntryStatistics stats)
          Validate an instance by giving some statistics.
 

Method Detail

create

InstanceType create(Clue clue)
                    throws org.ow2.util.pool.api.PoolException
Creates an instance with the given hint.

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

isMatching

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

Parameters:
instance - 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.

remove

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

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

validate

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

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


Copyright © 2007-2009 OW2 Consortium. All Rights Reserved.