org.objectweb.jonas.resource.pool.lib
Class HArrayPool

java.lang.Object
  extended byorg.objectweb.jonas.resource.pool.lib.HArrayPool
All Implemented Interfaces:
Pool

public class HArrayPool
extends java.lang.Object
implements Pool

The class HArrayPool implements a Pool as a HashSet of ManagedConnections, managing free/active resources. Updated to use an LRU list of free resources Author: Eric HARDESTY


Constructor Summary
HArrayPool()
           
 
Method Summary
 void check4MaxAge()
          check4MaxAge checks the age of the entries and removes them if they are too old
 PoolMatchFactory getMatchFactory()
          getMatchFactory retrieves the PoolMatchFactory assigned to this Pool.
 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 Object from the Pool.
 int getSize()
          getSize retrieves the current size of this Pool.
 long getTimeout()
          getTimeout retrieves the timeout assigned to this Pool.
 void releaseResource(java.lang.Object resource, boolean destroy)
          releaseResource releases a Object in order to allow the Pool to recycle this Object.
 void setInitSize(int initsize)
          setInitSize creates initsize resoures to this Pool.
 void setMatchFactory(PoolMatchFactory pmf)
          setMatchFactory assigns a PoolMatchFactory to this Pool.
 void setMaxAge(long _maxAge)
          setMaxAge sets the max age for a pool entry
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HArrayPool

public HArrayPool()
Method Detail

check4MaxAge

public void check4MaxAge()
Description copied from interface: Pool
check4MaxAge checks the age of the entries and removes them if they are too old

Specified by:
check4MaxAge in interface Pool
See Also:
Pool.check4MaxAge()

getTimeout

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

Specified by:
getTimeout in interface Pool
Returns:
The timeout currently assigned to this Pool.
See Also:
Pool.getTimeout()

getMinSize

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

Specified by:
getMinSize in interface Pool
Returns:
The minimum size currently assigned to this Pool.
See Also:
Pool.getMinSize()

getMatchFactory

public PoolMatchFactory getMatchFactory()
Description copied from interface: Pool
getMatchFactory retrieves the PoolMatchFactory assigned to this Pool.

Specified by:
getMatchFactory in interface Pool
Returns:
The PoolMatchFactory currently assigned to this Pool.
See Also:
Pool.getMatchFactory()

getMaxSize

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

Specified by:
getMaxSize in interface Pool
Returns:
The maximum size currently assigned to this Pool.
See Also:
Pool.getMaxSize()

getResource

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

Specified by:
getResource in interface Pool
Parameters:
hints - Some properties to specialise the matching or the creation of Object.
Returns:
The Object allocated from the Pool.
Throws:
java.lang.Exception
See Also:
Pool.getResource(java.lang.Object)

getSize

public int getSize()
Description copied from interface: Pool
getSize retrieves the current size of this Pool.

Specified by:
getSize in interface Pool
Returns:
The current size of this Pool.

releaseResource

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

Specified by:
releaseResource in interface Pool
Parameters:
resource - The Object to be released.
destroy - boolean to remove the object from the pool and destroy it
Throws:
java.lang.Exception
See Also:
Pool.releaseResource(java.lang.Object, boolean)

setMaxAge

public void setMaxAge(long _maxAge)
Description copied from interface: Pool
setMaxAge sets the max age for a pool entry

Specified by:
setMaxAge in interface Pool
See Also:
Pool.setMaxAge(long)

setInitSize

public void setInitSize(int initsize)
                 throws java.lang.Exception
Description copied from interface: Pool
setInitSize creates initsize resoures to this Pool.

Specified by:
setInitSize in interface Pool
Parameters:
initsize - The init size to be created.
Throws:
java.lang.Exception
See Also:
Pool.setInitSize(int)

setMatchFactory

public void setMatchFactory(PoolMatchFactory pmf)
Description copied from interface: Pool
setMatchFactory assigns a PoolMatchFactory to this Pool.

Specified by:
setMatchFactory in interface Pool
Parameters:
pmf - The PoolMatchFactory to be assigned.
See Also:
Pool.setMatchFactory(org.objectweb.jonas.resource.pool.api.PoolMatchFactory)

setMaxSize

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

Specified by:
setMaxSize in interface Pool
Parameters:
maxsize - The maximum size to be assigned.
Throws:
java.lang.Exception
See Also:
Pool.setMaxSize(int)

setMinSize

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

Specified by:
setMinSize in interface Pool
Parameters:
minsize - The minimum size to be assigned.
Throws:
java.lang.Exception
See Also:
Pool.setMinSize(int)

setTimeout

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

Specified by:
setTimeout in interface Pool
Parameters:
crto - The timeout to be assigned.
See Also:
Pool.setTimeout(long)