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

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

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


getJdbcConnLevel

int getJdbcConnLevel()
getJdbcConnLevel gets the jdbc connection level

Returns:
int jdbc connection level specified

getJdbcTestStatement

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

Returns:
String JDBC test statement

getMatchFactory

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

Returns:
The PoolMatchFactory currently assigned to this Pool.

getMaxAge

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

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

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

Returns:
The maximum size currently assigned to this Pool.

getMaxWaiters

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

Parameters:
return - int maximum number of waiters

getMaxWaitTime

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

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

Returns:
The minimum size currently assigned to this Pool.

getResource

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

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

Returns:
int number of seconds between samplings

getTimeout

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

Returns:
The timeout currently assigned to this Pool.

getSize

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

Returns:
The current size of this Pool.

getInitSize

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

releaseResource

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

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

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

setInitSize

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

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

Parameters:
jdbcConnLevel - int JDBC connection level

setJdbcTestStatement

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

Parameters:
jdbcTestStatement - String JDBC test statement

setMatchFactory

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

Parameters:
pmf - The PoolMatchFactory to be assigned.

setMaxAge

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

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

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

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

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

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

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

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

Parameters:
crto - long timeout to be assigned.

startMonitor

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


validateMCs

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

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

getCurrentBusy

int getCurrentBusy()
Returns:
int number of busy connections

getCurrentOpened

int getCurrentOpened()
Returns:
int number of opened connections

getBusyMaxRecent

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

getBusyMinRecent

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

getCurrentWaiters

int getCurrentWaiters()
Returns:
current number of connection waiters

getOpenedCount

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

getConnectionFailures

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

getConnectionLeaks

int getConnectionLeaks()
Returns:
int number of connection leaks

getServedOpen

int getServedOpen()
Returns:
int number of connection served

getRejectedFull

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

getRejectedTimeout

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

getRejectedOther

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

getRejectedOpen

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

getWaitersHigh

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

getWaitersHighRecent

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

getWaiterCount

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

getWaitingTime

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

getWaitingHigh

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

getWaitingHighRecent

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