Class TomcatConnectionPoolConfigurator
java.lang.Object
com.reallifedeveloper.common.infrastructure.jmx.TomcatConnectionPoolConfigurator
- All Implemented Interfaces:
ConnectionPoolConfiguratorMXBean
@ManagedResource(description="Connection Pool Configuration")
public final class TomcatConnectionPoolConfigurator
extends Object
implements ConnectionPoolConfiguratorMXBean
An implementation of the JMX
ConnectionPoolConfiguratorMXBean interface that delegates to an
org.apache.tomcat.jdbc.pool.DataSource object.- Author:
- RealLifeDeveloper
-
Constructor Summary
ConstructorsConstructorDescriptionTomcatConnectionPoolConfigurator(org.apache.tomcat.jdbc.pool.DataSource ds) Creates a newTomcatConnectionPoolConfiguratorthat delegates to the given data source. -
Method Summary
Modifier and TypeMethodDescriptionvoidForces an abandon check on the connection pool.voidForces a check for resizing of the idle connections.intGives the number of connections in use by the application.Gives the fully qualified Java class name of the JDBC driver used.intgetIdle()Gives the number of established but idle connections.intgetSize()Gives the current size of the pool.getUrl()Gives the URL used to connect to the database.intGives the number of threads waiting for a connection.voidpurge()Purges all connections in the pool.voidPurges connections when they are returned from the pool.voidtestIdle()Performs a validation on idle connections.
-
Constructor Details
-
TomcatConnectionPoolConfigurator
public TomcatConnectionPoolConfigurator(org.apache.tomcat.jdbc.pool.DataSource ds) Creates a newTomcatConnectionPoolConfiguratorthat delegates to the given data source.- Parameters:
ds- the data source to delegate to
-
-
Method Details
-
getUrl
Description copied from interface:ConnectionPoolConfiguratorMXBeanGives the URL used to connect to the database.- Specified by:
getUrlin interfaceConnectionPoolConfiguratorMXBean- Returns:
- the configured URL for this connection pool
-
getDriverClassName
@ManagedAttribute(description="The fully qualified JDBC driver name") public String getDriverClassName()Description copied from interface:ConnectionPoolConfiguratorMXBeanGives the fully qualified Java class name of the JDBC driver used.- Specified by:
getDriverClassNamein interfaceConnectionPoolConfiguratorMXBean- Returns:
- the fully qualified JDBC driver name
-
getSize
@ManagedAttribute(description="The current size of the pool") public int getSize()Description copied from interface:ConnectionPoolConfiguratorMXBeanGives the current size of the pool.- Specified by:
getSizein interfaceConnectionPoolConfiguratorMXBean- Returns:
- the current size of the pool
-
getIdle
@ManagedAttribute(description="The number of established but idle connections") public int getIdle()Description copied from interface:ConnectionPoolConfiguratorMXBeanGives the number of established but idle connections.- Specified by:
getIdlein interfaceConnectionPoolConfiguratorMXBean- Returns:
- the number of established but idle connections
-
getActive
@ManagedAttribute(description="The number of connections in use by the application") public int getActive()Description copied from interface:ConnectionPoolConfiguratorMXBeanGives the number of connections in use by the application.- Specified by:
getActivein interfaceConnectionPoolConfiguratorMXBean- Returns:
- the number of connections in use by the application
-
getWaitCount
@ManagedAttribute(description="The number of threads waiting for a connection") public int getWaitCount()Description copied from interface:ConnectionPoolConfiguratorMXBeanGives the number of threads waiting for a connection.- Specified by:
getWaitCountin interfaceConnectionPoolConfiguratorMXBean- Returns:
- the number of threads waiting for a connection
-
checkIdle
@ManagedOperation(description="Forces a check for resizing of the idle connections") public void checkIdle()Description copied from interface:ConnectionPoolConfiguratorMXBeanForces a check for resizing of the idle connections.- Specified by:
checkIdlein interfaceConnectionPoolConfiguratorMXBean
-
checkAbandoned
@ManagedOperation(description="Forces an abandon check on the connection pool") public void checkAbandoned()Description copied from interface:ConnectionPoolConfiguratorMXBeanForces an abandon check on the connection pool.If connections that have been abandoned exists, they will be closed during this run.
- Specified by:
checkAbandonedin interfaceConnectionPoolConfiguratorMXBean
-
testIdle
@ManagedOperation(description="Performs a validation on idle connections") public void testIdle()Description copied from interface:ConnectionPoolConfiguratorMXBeanPerforms a validation on idle connections.- Specified by:
testIdlein interfaceConnectionPoolConfiguratorMXBean
-
purge
@ManagedOperation(description="Purges all connections in the pool") public void purge()Description copied from interface:ConnectionPoolConfiguratorMXBeanPurges all connections in the pool. For connections currently in use, these connections will be purged when returned on the pool. This call also purges connections that are idle and in the pool.To only purge used/active connections see
ConnectionPoolConfiguratorMXBean.purgeOnReturn()- Specified by:
purgein interfaceConnectionPoolConfiguratorMXBean
-
purgeOnReturn
@ManagedOperation(description="Purges connections when they are returned from the pool") public void purgeOnReturn()Description copied from interface:ConnectionPoolConfiguratorMXBeanPurges connections when they are returned from the pool. This call does not purge idle connections until they are used.To purge idle connections see
ConnectionPoolConfiguratorMXBean.purge()- Specified by:
purgeOnReturnin interfaceConnectionPoolConfiguratorMXBean
-