org.objectweb.perseus.pool.lib
Class LArrayPool

java.lang.Object
  extended byorg.objectweb.perseus.pool.lib.LArrayPool
All Implemented Interfaces:
Pool, PoolAttributes

public class LArrayPool
extends java.lang.Object
implements Pool, PoolAttributes

The class LArrayPool implements a Pool as an array of PoolResource, managing free/active resources through lists of cells encapsulating the resources.

Author:
P.Dechamboux

Field Summary
static java.lang.String POOL_MATCH_FACTORY_BINDING
           
 
Constructor Summary
LArrayPool()
           
 
Method Summary
 void bindFc(java.lang.String clientItfName, java.lang.Object serverItf)
           
 int getFreeResourceNumber()
           
 long getInactiveTTL()
          getTTL retrieves the time to live of pool resources when they are unused (in milisecond).
 int getMaxSize()
          getMaxSize retrieves the maximum size assigned to this Pool.
 int getMinSize()
          getMinSize retrieves the minimum size assigned to this Pool.
 java.lang.Object getResource(java.lang.Object hints)
          getResource is used to allocate a PoolResource from the Pool.
 java.lang.Object getResource(java.lang.Object hints, java.lang.Object user)
          getResource is used to allocate a PoolResource from the Pool.
 int getSize()
           
 long getTimeout()
          getTimeout retrieves the timeout assigned to this Pool.
 long getTTL()
          getTTL retrieves the time to live of pool resources (in milisecond).
 int getUsedResourceNumber()
           
 java.util.Collection getUsers()
           
 java.lang.String[] listFc()
           
 java.lang.Object lookupFc(java.lang.String clientItfName)
           
 void releaseResource(java.lang.Object resource)
          releaseResource releases a PoolResource in order to allow the Pool to recycle this PoolResource.
 void setInactiveTTL(long ttl)
          setTTL assignes the time (in milisecond) to live of pool resources when they are unused.
 void setMaxSize(int maxsize)
          setMaxSize assigns a maximum size to this Pool.
 void setMinSize(int minsize)
          setMinSize assigns a minimum size to this Pool.
 void setTimeout(long crto)
          setTimeout assigns a timeout to this Pool.
 void setTTL(long ttl)
          setTTL assignes the time (in milisecond) to live of pool resources.
 void unbindFc(java.lang.String clientItfName)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

POOL_MATCH_FACTORY_BINDING

public static final java.lang.String POOL_MATCH_FACTORY_BINDING
See Also:
Constant Field Values
Constructor Detail

LArrayPool

public LArrayPool()
Method Detail

listFc

public java.lang.String[] listFc()

lookupFc

public java.lang.Object lookupFc(java.lang.String clientItfName)

bindFc

public void bindFc(java.lang.String clientItfName,
                   java.lang.Object serverItf)

unbindFc

public void unbindFc(java.lang.String clientItfName)

getTimeout

public long getTimeout()
Description copied from interface: PoolAttributes
getTimeout retrieves the timeout assigned to this Pool.

Specified by:
getTimeout in interface PoolAttributes
Returns:
The timeout currently assigned to this Pool.

getMinSize

public int getMinSize()
Description copied from interface: PoolAttributes
getMinSize retrieves the minimum size assigned to this Pool.

Specified by:
getMinSize in interface PoolAttributes
Returns:
The minimum size currently assigned to this Pool.

getMaxSize

public int getMaxSize()
Description copied from interface: PoolAttributes
getMaxSize retrieves the maximum size assigned to this Pool.

Specified by:
getMaxSize in interface PoolAttributes
Returns:
The maximum size currently assigned to this Pool.

setTimeout

public void setTimeout(long crto)
Description copied from interface: PoolAttributes
setTimeout assigns a timeout to this Pool.

Specified by:
setTimeout in interface PoolAttributes
Parameters:
crto - The timeout to be assigned.

setMinSize

public void setMinSize(int minsize)
Description copied from interface: PoolAttributes
setMinSize assigns a minimum size to this Pool.

Specified by:
setMinSize in interface PoolAttributes
Parameters:
minsize - The minimum size to be assigned.

setMaxSize

public void setMaxSize(int maxsize)
Description copied from interface: PoolAttributes
setMaxSize assigns a maximum size to this Pool.

Specified by:
setMaxSize in interface PoolAttributes
Parameters:
maxsize - The maximum size to be assigned.

getTTL

public long getTTL()
Description copied from interface: PoolAttributes
getTTL retrieves the time to live of pool resources (in milisecond).

Specified by:
getTTL in interface PoolAttributes

setTTL

public void setTTL(long ttl)
Description copied from interface: PoolAttributes
setTTL assignes the time (in milisecond) to live of pool resources. If the value is lesser or equal to 0 then pool resources do not have a TTL.

Specified by:
setTTL in interface PoolAttributes

getInactiveTTL

public long getInactiveTTL()
Description copied from interface: PoolAttributes
getTTL retrieves the time to live of pool resources when they are unused (in milisecond).

Specified by:
getInactiveTTL in interface PoolAttributes

setInactiveTTL

public void setInactiveTTL(long ttl)
Description copied from interface: PoolAttributes
setTTL assignes the time (in milisecond) to live of pool resources when they are unused. If the value is lesser or equal to 0 then pool resources do not have a TTL.

Specified by:
setInactiveTTL in interface PoolAttributes

getResource

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

Specified by:
getResource in interface Pool
Parameters:
hints - Some properties to specialise the matching or the creation of PoolResource.
Returns:
The PoolResource allocated from the Pool.
Throws:
PoolException

getResource

public java.lang.Object getResource(java.lang.Object hints,
                                    java.lang.Object user)
                             throws PoolException
Description copied from interface: Pool
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.

Specified by:
getResource in interface Pool
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.
Throws:
PoolException

getSize

public int getSize()
Specified by:
getSize in interface Pool
Returns:
the number resource used and free

getFreeResourceNumber

public int getFreeResourceNumber()
Specified by:
getFreeResourceNumber in interface Pool
Returns:
the number of unsused resource

getUsedResourceNumber

public int getUsedResourceNumber()
Specified by:
getUsedResourceNumber in interface Pool
Returns:
the number of used resource

getUsers

public java.util.Collection getUsers()
Specified by:
getUsers in interface Pool
Returns:
collection of user. The collection can be empty even if resource are used, in case of the user did not specify any reference on getResource.

releaseResource

public void releaseResource(java.lang.Object resource)
                     throws PoolException
Description copied from interface: Pool
releaseResource releases a PoolResource in order to allow the Pool to recycle this PoolResource.

Specified by:
releaseResource in interface Pool
Parameters:
resource - The PoolResource to be released.
Throws:
PoolException


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