org.sadun.util.pool.connection
Class ManagedConnectionPool

java.lang.Object
  extended byorg.sadun.util.pool.connection.ManagedConnectionPool
All Implemented Interfaces:
ManagedConnectionPoolMBean, WatchDog.Listener

public class ManagedConnectionPool
extends java.lang.Object
implements ManagedConnectionPoolMBean, WatchDog.Listener

NOT COMPLETE YET

Author:
Cristiano Sadun

Constructor Summary
ManagedConnectionPool()
           
 
Method Summary
 void checkFailed(java.lang.Object obj, java.lang.Throwable e)
          Notifies the listener that a check has failed.
 void checkImpossible(java.lang.Object obj, WatchDogException e)
          Notifies the listener that a check could not be performed.
 void checkOk(java.lang.Object obj)
          Notifies the listener that a check has been successful
 void disableWatchDog()
           
 void enableWatchDog()
          Enables the watchdog thread for the pool, registering this mbean as a listener
 java.lang.String getConnectionProperties()
          Return the connection properties of the pool (see setConnectionProperties() for details.
 int getFreeCount()
          Return the number of available objects in the pool
 java.lang.String getJdbcDrivers()
          Return a list of JDBC driver classes to load, separated by colon/semicolon or comma.
 java.lang.String getJdbcURL()
          Return the jdbcURL accessed by this pool
 java.lang.Class getObjectType()
           
 int getSize()
          Return the size of the pool
 int getUsedCount()
          Return the number of used objects in the pool
 void setConnectionProperties(java.lang.String connectionProperties)
          Set the connection properties of the pool.
 void setJdbcDrivers(java.lang.String jdbcDrivers)
          Set the list of JDBC driver classes to load, separated by colon/semicolon or comma.
 void setJdbcURL(java.lang.String jdbcURL)
          Set the jdbc URL of the pool.
 void setSize(int size)
          Set the pool size.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ManagedConnectionPool

public ManagedConnectionPool()
Method Detail

setSize

public void setSize(int size)
             throws javax.management.MBeanException
Set the pool size. If the specified size is different than the current size, the pool is reset to the given size.

This property cannot be changed if some client has already acquired pooled objects.

Specified by:
setSize in interface ManagedConnectionPoolMBean
Parameters:
size - the new size
Throws:
javax.management.MBeanException

setJdbcURL

public void setJdbcURL(java.lang.String jdbcURL)
                throws javax.management.MBeanException
Set the jdbc URL of the pool.

This property cannot be changed if some client has already acquired pooled objects.

Specified by:
setJdbcURL in interface ManagedConnectionPoolMBean
Parameters:
jdbcURL - the new jdbcURL
Throws:
javax.management.MBeanException

setConnectionProperties

public void setConnectionProperties(java.lang.String connectionProperties)
                             throws javax.management.MBeanException
Set the connection properties of the pool.

This property cannot be changed if some client has already acquired pooled objects.

Specified by:
setConnectionProperties in interface ManagedConnectionPoolMBean
Parameters:
connectionProperties - the String defining the properties
Throws:
javax.management.MBeanException

setJdbcDrivers

public void setJdbcDrivers(java.lang.String jdbcDrivers)
                    throws javax.management.MBeanException
Set the list of JDBC driver classes to load, separated by colon/semicolon or comma.

Specified by:
setJdbcDrivers in interface ManagedConnectionPoolMBean
Parameters:
jdbcDrivers - the list of JDBC driver classes to load, separated by colon/semicolon or comma.
Throws:
javax.management.MBeanException

getFreeCount

public int getFreeCount()
Description copied from interface: ManagedConnectionPoolMBean
Return the number of available objects in the pool

Specified by:
getFreeCount in interface ManagedConnectionPoolMBean
Returns:
the number of available objects in the pool
See Also:
ManagedObjectPoolMBean.getFreeCount()

getObjectType

public java.lang.Class getObjectType()

getSize

public int getSize()
Description copied from interface: ManagedConnectionPoolMBean
Return the size of the pool

Specified by:
getSize in interface ManagedConnectionPoolMBean
Returns:
the size of the pool

getUsedCount

public int getUsedCount()
Description copied from interface: ManagedConnectionPoolMBean
Return the number of used objects in the pool

Specified by:
getUsedCount in interface ManagedConnectionPoolMBean
Returns:
the number of used objects in the pool

getJdbcURL

public java.lang.String getJdbcURL()
Description copied from interface: ManagedConnectionPoolMBean
Return the jdbcURL accessed by this pool

Specified by:
getJdbcURL in interface ManagedConnectionPoolMBean
Returns:
the jdbcURL accessed by this pool

getConnectionProperties

public java.lang.String getConnectionProperties()
Description copied from interface: ManagedConnectionPoolMBean
Return the connection properties of the pool (see setConnectionProperties() for details.

Specified by:
getConnectionProperties in interface ManagedConnectionPoolMBean
Returns:

getJdbcDrivers

public java.lang.String getJdbcDrivers()
Return a list of JDBC driver classes to load, separated by colon/semicolon or comma.

Specified by:
getJdbcDrivers in interface ManagedConnectionPoolMBean
Returns:
a list of JDBC driver classes to load, separated by colon/semicolon or comma.

enableWatchDog

public void enableWatchDog()
Enables the watchdog thread for the pool, registering this mbean as a listener


disableWatchDog

public void disableWatchDog()

checkFailed

public void checkFailed(java.lang.Object obj,
                        java.lang.Throwable e)
Description copied from interface: WatchDog.Listener
Notifies the listener that a check has failed.

Specified by:
checkFailed in interface WatchDog.Listener
Parameters:
e -

checkImpossible

public void checkImpossible(java.lang.Object obj,
                            WatchDogException e)
Description copied from interface: WatchDog.Listener
Notifies the listener that a check could not be performed.

Specified by:
checkImpossible in interface WatchDog.Listener
Parameters:
e -

checkOk

public void checkOk(java.lang.Object obj)
Description copied from interface: WatchDog.Listener
Notifies the listener that a check has been successful

Specified by:
checkOk in interface WatchDog.Listener