How to check the connection pool with JMX ?(TransactionalDataSourceFactory)
aquamarine.m.b.s Jun 15, 2018 2:42 AMEnglish I forgive but I'm poor.
We have developed web application server for enterprise with your org.jboss.narayana.tomcat.jta.TransactionalDataSourceFactory.
We have watcher service to JMX.
So, we want to check the connection pool with JMX (like org.apach.tomcat.jdbc.pool.jmx.ConnectionPoolMBean).
- getIdle()
- getSize()
- getActive()
- getNumIdle()
- getNumActibe()
- getWaitCount()
But, we can't find it on JMX.
Please tell me how to check the connection pool with JMX .
Information details are as follows:
The following resources are found on JMX.
- Catalina:type=Resource,resourcetype=Context,host=localhost,context=/dl,class=javax.sql.XADataSource,name="transactionalDataSource"
- Catalina:type=Resource,resourcetype=Context,host=localhost,context=/dl,class=javax.transaction.TransactionManager,name="TransactionManager"
- Catalina:type=Resource,resourcetype=Context,host=localhost,context=/dl,class=javax.transaction.TransactionSynchronizationRegistry,name="TransactionSynchronizationRegistry"
- Catalina:type=Resource,resourcetype=Global,class=org.apache.catalina.UserDatabase,name="UserDatabase"
- Catalina:type=Resource,resourcetype=Context,host=localhost,context=/dl,class=org.postgresql.xa.PGXADataSource,name="postgresDS"
But, they have only the following JMX info.
Specification
Tomcat 9.0.8
pom.xml
<dependency>
<groupId>org.jboss.narayana.tomcat</groupId>
<artifactId>tomcat-jta</artifactId>
<version>5.8.2.Final</version>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
context.xml is put on "webapp/contextpath/META-INF/context.xml".
<Transaction factory="org.jboss.narayana.tomcat.jta.UserTransactionFactory" /> <Resource factory="org.jboss.narayana.tomcat.jta.TransactionManagerFactory" name="TransactionManager" type="javax.transaction.TransactionManager"/> <Resource factory="org.jboss.narayana.tomcat.jta.TransactionSynchronizationRegistryFactory" name="TransactionSynchronizationRegistry" type="javax.transaction.TransactionSynchronizationRegistry" /> <Resource name="postgresDS" uniqueName="myDataSource" auth="Container" type="org.postgresql.xa.PGXADataSource" factory="org.postgresql.xa.PGXADataSourceFactory" databaseName="@AURORA_DATABASE_NAME@" jmxEnabled="true" user="@AURORA_USER@" password="@AURORA_PASSWORD@" portNumber="@AURORA_PORT@" serverName="@AURORA_SERVER_NAME@"/> <Resource name="transactionalDataSource" uniqueName="transactionalDataSource" auth="Container" xaDataSource="postgresDS" type="javax.sql.XADataSource" factory="org.jboss.narayana.tomcat.jta.TransactionalDataSourceFactory" transactionManager="TransactionManager" driverClassName="com.arjuna.ats.jdbc.TransactionalDriver" username="@AURORA_USER@" initialSize="@AURORA_INITIAL_SIZE@" minIdle="@AURORA_MIN_IDLE@" maxActive="@AURORA_MAX_ACTIVE@" jmxEnabled="true" validationQuery="SELECT 1" validationInterval="10000"/>
We already checked that the connection pool is enabled.
(We changed the parameter of connection pool then checked the number of connections.)
Thanks.