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 newTomcatConnectionPoolConfigurator
that delegates to the given data source. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Forces an abandon check on the connection pool.void
Forces a check for resizing of the idle connections.int
Gives the number of connections in use by the application.Gives the fully qualified Java class name of the JDBC driver used.int
getIdle()
Gives the number of established but idle connections.int
getSize()
Gives the current size of the pool.getUrl()
Gives the URL used to connect to the database.int
Gives the number of threads waiting for a connection.void
purge()
Purges all connections in the pool.void
Purges connections when they are returned from the pool.void
testIdle()
Performs a validation on idle connections.
-
Constructor Details
-
TomcatConnectionPoolConfigurator
public TomcatConnectionPoolConfigurator(org.apache.tomcat.jdbc.pool.DataSource ds) Creates a newTomcatConnectionPoolConfigurator
that delegates to the given data source.- Parameters:
ds
- the data source to delegate to
-
-
Method Details
-
getUrl
Description copied from interface:ConnectionPoolConfiguratorMXBean
Gives the URL used to connect to the database.- Specified by:
getUrl
in 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:ConnectionPoolConfiguratorMXBean
Gives the fully qualified Java class name of the JDBC driver used.- Specified by:
getDriverClassName
in interfaceConnectionPoolConfiguratorMXBean
- Returns:
- the fully qualified JDBC driver name
-
getSize
@ManagedAttribute(description="The current size of the pool") public int getSize()Description copied from interface:ConnectionPoolConfiguratorMXBean
Gives the current size of the pool.- Specified by:
getSize
in 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:ConnectionPoolConfiguratorMXBean
Gives the number of established but idle connections.- Specified by:
getIdle
in 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:ConnectionPoolConfiguratorMXBean
Gives the number of connections in use by the application.- Specified by:
getActive
in 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:ConnectionPoolConfiguratorMXBean
Gives the number of threads waiting for a connection.- Specified by:
getWaitCount
in 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:ConnectionPoolConfiguratorMXBean
Forces a check for resizing of the idle connections.- Specified by:
checkIdle
in interfaceConnectionPoolConfiguratorMXBean
-
checkAbandoned
@ManagedOperation(description="Forces an abandon check on the connection pool") public void checkAbandoned()Description copied from interface:ConnectionPoolConfiguratorMXBean
Forces an abandon check on the connection pool.If connections that have been abandoned exists, they will be closed during this run.
- Specified by:
checkAbandoned
in interfaceConnectionPoolConfiguratorMXBean
-
testIdle
@ManagedOperation(description="Performs a validation on idle connections") public void testIdle()Description copied from interface:ConnectionPoolConfiguratorMXBean
Performs a validation on idle connections.- Specified by:
testIdle
in interfaceConnectionPoolConfiguratorMXBean
-
purge
@ManagedOperation(description="Purges all connections in the pool") public void purge()Description copied from interface:ConnectionPoolConfiguratorMXBean
Purges 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:
purge
in interfaceConnectionPoolConfiguratorMXBean
-
purgeOnReturn
@ManagedOperation(description="Purges connections when they are returned from the pool") public void purgeOnReturn()Description copied from interface:ConnectionPoolConfiguratorMXBean
Purges 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:
purgeOnReturn
in interfaceConnectionPoolConfiguratorMXBean
-