org.objectweb.perseus.pool.api

Interface PoolMatchFactory

public interface PoolMatchFactory

The interface PoolMatchFactory defines the object used by a Pool to test if a given resource of a Pool matches with the hints passed with the Pool getResource method. It also allows such a Pool to allocate a PoolResource as needed, conforming to the passed hints. Finally the factory is called when a resource is going to be destroyed.

Author:
S.Chassande-Barrioz, P.Dechamboux

Method Summary

Object
createResource(Object hints)
createResource creates a new PoolResource.
void
destroyResource(Object resource)
is called when a resource is going to be destroyed.
boolean
matchResource(Object resource, Object hints)
matchResource tests if a given resource of a Pool matches with the hints passed with the Pool getResource method.

Method Details

createResource

public Object createResource(Object hints)
            throws PoolException
createResource creates a new PoolResource.

Parameters:
hints - The "properties" that the created PoolResource should conform to.

Returns:
The created PoolResource.


destroyResource

public void destroyResource(Object resource)
is called when a resource is going to be destroyed. This method permits to close physical resource for example.

Parameters:
resource - to initialize.


matchResource

public boolean matchResource(Object resource,
                             Object hints)
matchResource tests if a given resource of a Pool matches with the hints passed with the Pool getResource method.

Parameters:
resource - The PoolResource to test its matching with some "properties" specified by hints.
hints - The "properties" that the PoolResource specified by pr should match.

Returns:
true if the pr PoolResource matches the hints "properties".


Copyright © 2000-2002 France Telecom S.A., INRIA, IMAG-LSR All Rights Reserved.