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
 java.lang.Object createResource(java.lang.Object hints)
          createResource creates a new PoolResource.
 void destroyResource(java.lang.Object resource)
          is called when a resource is going to be destroyed.
 boolean matchResource(java.lang.Object resource, java.lang.Object hints)
          matchResource tests if a given resource of a Pool matches with the hints passed with the Pool getResource method.
 

Method Detail

createResource

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

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

matchResource

public boolean matchResource(java.lang.Object resource,
                             java.lang.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".

destroyResource

public void destroyResource(java.lang.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.


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