org.objectweb.jonas.resource.pool.api
Interface Pool

All Known Implementing Classes:
HArrayPool

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 accessor methods (getters and setters) assigned to each of them:


Method Summary
 void adjust()
          adjust checks the age of the entries and removes them if they are too old
 void closeAllConnections()
          Close all connections in the pool when server is shutting down.
 int getBusyMaxRecent()
           
 int getBusyMinRecent()
           
 int getConnectionFailures()
           
 int getConnectionLeaks()
           
 int getCurrentBusy()
           
 int getCurrentOpened()
           
 int getCurrentWaiters()
           
 int getInitSize()
           
 int getJdbcConnLevel()
          getJdbcConnLevel gets the jdbc connection level
 java.lang.String getJdbcTestStatement()
          getJdbcTestStatement gets the JDBC test statement for this pool
 PoolMatchFactory getMatchFactory()
          getMatchFactory retrieves the PoolMatchFactory assigned to this Pool.
 int getMaxAge()
          getMaxAge gets the max age for a pool entry
 int getMaxOpentime()
          getMaxOpentime gets the max age for a pool entry
 int getMaxSize()
          getMaxSize retrieves the maximum size assigned to this Pool.
 int getMaxWaiters()
          getMaxWaiters gets the maximum number of waiters for a connection in this Pool.
 int getMaxWaitTime()
          getMaxWaitTime gets the maximum number of seconds to wait for a connection in this Pool.
 int getMinSize()
          getMinSize retrieves the minimum size assigned to this Pool.
 int getOpenedCount()
           
 int getRejectedFull()
           
 int getRejectedOpen()
           
 int getRejectedOther()
           
 int getRejectedTimeout()
           
 java.lang.Object getResource(java.lang.Object hints)
          getResource is used to allocate a Object from the Pool.
 int getSamplingPeriod()
          getSamplingPeriod gets the number of seconds between statistics sampling for this Pool.
 int getServedOpen()
           
 int getSize()
          getSize retrieves the current size of this Pool.
 long getTimeout()
          getTimeout retrieves the timeout assigned to this Pool.
 int getWaiterCount()
           
 int getWaitersHigh()
           
 int getWaitersHighRecent()
           
 long getWaitingHigh()
           
 long getWaitingHighRecent()
           
 long getWaitingTime()
           
 void releaseResource(java.lang.Object resource, boolean destroy, boolean adjustment)
          releaseResource releases a Object in order to allow the Pool to recycle this Object.
 void sampling()
          sampling updates the interval pool information
 void setInitSize(int initsize)
          setInitSize creates initsize resoures to this Pool.
 void setJdbcConnLevel(int jdbcConnLevel)
          setJdbcConnLevel sets the JDBC connection level for this pool
 void setJdbcTestStatement(java.lang.String jdbcTestStatement)
          setJdbcTestStatement sets the JDBC test statement for this pool
 void setMatchFactory(PoolMatchFactory pmf)
          setMatchFactory assigns a PoolMatchFactory to this Pool.
 void setMaxAge(int maxAge)
          setMaxAge sets the max age for a pool entry
 void setMaxOpentime(int maxOpentime)
          setMaxOpentime sets the max age for an entry to be opened
 void setMaxSize(int maxsize)
          setMaxSize assigns a maximum size to this Pool.
 void setMaxWaiters(int maxWaiters)
          setMaxWaiters sets the maximum number of waiters for a connection in this Pool.
 void setMaxWaitTime(int maxWaitTime)
          setMaxWaitTime sets the maximum number of seconds to wait for a connection in this Pool.
 void setMinSize(int minsize)
          setMinSize assigns a minimum size to this Pool.
 void setSamplingPeriod(int samplingPeriod)
          setSamplingPeriod sets the number of seconds between statistics sampling for this Pool.
 void setTimeout(long crto)
          setTimeout assigns a timeout to this Pool.
 void startMonitor()
          startMonitor starts the pool monitor for this Pool.
 void validateMCs()
          validateMCs validates ManagedConnections in Pool every 10 minutes
 

Method Detail

adjust

public void adjust()
            throws java.lang.Exception
adjust checks the age of the entries and removes them if they are too old

Throws:
java.lang.Exception - if an error occurs

closeAllConnections

public void closeAllConnections()
Close all connections in the pool when server is shutting down.


getJdbcConnLevel

public int getJdbcConnLevel()
getJdbcConnLevel gets the jdbc connection level

Returns:
int jdbc connection level specified

getJdbcTestStatement

public java.lang.String getJdbcTestStatement()
getJdbcTestStatement gets the JDBC test statement for this pool

Returns:
String JDBC test statement

getMatchFactory

public PoolMatchFactory getMatchFactory()
getMatchFactory retrieves the PoolMatchFactory assigned to this Pool.

Returns:
The PoolMatchFactory currently assigned to this Pool.

getMaxAge

public int getMaxAge()
getMaxAge gets the max age for a pool entry

Returns:
int max number of minutes to keep a connection in the pool.

getMaxOpentime

public int getMaxOpentime()
getMaxOpentime gets the max age for a pool entry

Returns:
int max number of minutes to keep a connection in the pool.

getMaxSize

public int getMaxSize()
getMaxSize retrieves the maximum size assigned to this Pool.

Returns:
The maximum size currently assigned to this Pool.

getMaxWaiters

public int getMaxWaiters()
getMaxWaiters gets the maximum number of waiters for a connection in this Pool.


getMaxWaitTime

public int getMaxWaitTime()
getMaxWaitTime gets the maximum number of seconds to wait for a connection in this Pool.

Returns:
int maximum number of seconds to wait

getMinSize

public int getMinSize()
getMinSize retrieves the minimum size assigned to this Pool.

Returns:
The minimum size currently assigned to this Pool.

getResource

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

Parameters:
hints - Some properties to specialise the matching or the creation of Object.
Returns:
The Object allocated from the Pool.
Throws:
java.lang.Exception - if an error occurs

getSamplingPeriod

public int getSamplingPeriod()
getSamplingPeriod gets the number of seconds between statistics sampling for this Pool.

Returns:
int number of seconds between samplings

getTimeout

public long getTimeout()
getTimeout retrieves the timeout assigned to this Pool.

Returns:
The timeout currently assigned to this Pool.

getSize

public int getSize()
getSize retrieves the current size of this Pool.

Returns:
The current size of this Pool.

getInitSize

public int getInitSize()
Returns:
init The pool init size.

releaseResource

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

Parameters:
resource - The Object to be released.
destroy - boolean to remove the object from the pool and destroy it
adjustment - boolean to determine if a pool adjustment should be done
Throws:
java.lang.Exception - if an error occurs

sampling

public void sampling()
              throws java.lang.Exception
sampling updates the interval pool information

Throws:
java.lang.Exception - if an error occurs

setInitSize

public void setInitSize(int initsize)
                 throws java.lang.Exception
setInitSize creates initsize resoures to this Pool.

Parameters:
initsize - The init size to be created.
Throws:
java.lang.Exception - if an error occurs

setJdbcConnLevel

public void setJdbcConnLevel(int jdbcConnLevel)
setJdbcConnLevel sets the JDBC connection level for this pool

Parameters:
jdbcConnLevel - int JDBC connection level

setJdbcTestStatement

public void setJdbcTestStatement(java.lang.String jdbcTestStatement)
setJdbcTestStatement sets the JDBC test statement for this pool

Parameters:
jdbcTestStatement - String JDBC test statement

setMatchFactory

public void setMatchFactory(PoolMatchFactory pmf)
setMatchFactory assigns a PoolMatchFactory to this Pool.

Parameters:
pmf - The PoolMatchFactory to be assigned.

setMaxAge

public void setMaxAge(int maxAge)
setMaxAge sets the max age for a pool entry

Parameters:
maxAge - int max number of minutes to keep a connection in the pool.

setMaxOpentime

public void setMaxOpentime(int maxOpentime)
setMaxOpentime sets the max age for an entry to be opened

Parameters:
maxOpentime - int max number of minutes to keep a connection opened.

setMaxSize

public void setMaxSize(int maxsize)
                throws java.lang.Exception
setMaxSize assigns a maximum size to this Pool.

Parameters:
maxsize - int maximum size to be assigned.
Throws:
java.lang.Exception - if an error occurs

setMaxWaiters

public void setMaxWaiters(int maxWaiters)
setMaxWaiters sets the maximum number of waiters for a connection in this Pool.

Parameters:
maxWaiters - int maximum number of waiters

setMaxWaitTime

public void setMaxWaitTime(int maxWaitTime)
setMaxWaitTime sets the maximum number of seconds to wait for a connection in this Pool.

Parameters:
maxWaitTime - int maximum number of seconds to wait

setMinSize

public void setMinSize(int minsize)
                throws java.lang.Exception
setMinSize assigns a minimum size to this Pool.

Parameters:
minsize - int minimum size to be assigned.
Throws:
java.lang.Exception - if an error occurs

setSamplingPeriod

public void setSamplingPeriod(int samplingPeriod)
setSamplingPeriod sets the number of seconds between statistics sampling for this Pool.

Parameters:
samplingPeriod - int number of seconds between samplings

setTimeout

public void setTimeout(long crto)
setTimeout assigns a timeout to this Pool.

Parameters:
crto - long timeout to be assigned.

startMonitor

public void startMonitor()
startMonitor starts the pool monitor for this Pool.


validateMCs

public void validateMCs()
                 throws java.lang.Exception
validateMCs validates ManagedConnections in Pool every 10 minutes

Throws:
java.lang.Exception - if an error occurs

getCurrentBusy

public int getCurrentBusy()
Returns:
int number of busy connections

getCurrentOpened

public int getCurrentOpened()
Returns:
int number of opened connections

getBusyMaxRecent

public int getBusyMaxRecent()
Returns:
maximum nb of busy connections in last sampling period

getBusyMinRecent

public int getBusyMinRecent()
Returns:
minimum nb of busy connections in last sampling period

getCurrentWaiters

public int getCurrentWaiters()
Returns:
current number of connection waiters

getOpenedCount

public int getOpenedCount()
Returns:
int number of physical jdbc connection opened

getConnectionFailures

public int getConnectionFailures()
Returns:
int number of connection failures on open

getConnectionLeaks

public int getConnectionLeaks()
Returns:
int number of connection leaks

getServedOpen

public int getServedOpen()
Returns:
int number of connection served

getRejectedFull

public int getRejectedFull()
Returns:
int number of open calls that were rejected due to waiter overflow

getRejectedTimeout

public int getRejectedTimeout()
Returns:
int number of open calls that were rejected by timeout

getRejectedOther

public int getRejectedOther()
Returns:
int number of open calls that were rejected

getRejectedOpen

public int getRejectedOpen()
Returns:
int number of open calls that were rejected

getWaitersHigh

public int getWaitersHigh()
Returns:
maximum nb of waiters since the datasource creation

getWaitersHighRecent

public int getWaitersHighRecent()
Returns:
maximum nb of waiters in last sampling period

getWaiterCount

public int getWaiterCount()
Returns:
total nb of waiters since the datasource creation

getWaitingTime

public long getWaitingTime()
Returns:
total waiting time since the datasource creation

getWaitingHigh

public long getWaitingHigh()
Returns:
max waiting time since the datasource creation

getWaitingHighRecent

public long getWaitingHighRecent()
Returns:
max waiting time in last sampling period