org.objectweb.perseus.pool.api

Interface Pool

Known Implementing Classes:
ArrayListPool, LArrayPool

public interface Pool

The interface Pool defines an object that pools resources of any kind. Resources must be requested (getResource) and released (releaseResource) on demand. A Pool object can be parameterized along different dimensions. All these dimensions are represented by PoolAttributes interface.

Method Summary

Object
getResource(Object hints)
getResource is used to allocate a PoolResource from the Pool.
Object
getResource(Object hints, Object user)
getResource is used to allocate a PoolResource from the Pool.
int
getSize()
void
releaseResource(Object resource)
releaseResource releases a PoolResource in order to allow the Pool to recycle this PoolResource.

Method Details

getResource

public Object getResource(Object hints)
            throws PoolException
getResource is used to allocate a PoolResource from the Pool. Some hints are passed in order to specialise the matching or creation of PoolResource.

Parameters:
hints - Some properties to specialise the matching or the creation of PoolResource.

Returns:
The PoolResource allocated from the Pool.


getResource

public Object getResource(Object hints,
                          Object user)
            throws PoolException,
                   DeadLockException
getResource is used to allocate a PoolResource from the Pool. Some hints are passed in order to specialise the matching or creation of PoolResource. The user parameter avoids dead lock by the use of a dependency graph.

Parameters:
hints - Some properties to specialise the matching or the creation of PoolResource.
user - is an identifier of the context wanting a resource in the pool.

Returns:
The PoolResource allocated from the Pool.


getSize

public int getSize()

Returns:
the number resource used and free


releaseResource

public void releaseResource(Object resource)
            throws PoolException
releaseResource releases a PoolResource in order to allow the Pool to recycle this PoolResource.

Parameters:
resource - The PoolResource to be released.


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