Lasantha,

> -----Original Message-----
> From: Lasantha Samarakoon <lasn1...@gmail.com>
> Sent: Monday, September 06, 2021 10:22 PM
> To: users@tomcat.apache.org
> Subject: Calculate time to get a connection from JDBC Pool
> 
> Hi all,
> 
> I am working on Tomcat JDBC Pools and I have a requirement that needs to
> calculate the total time it takes to get a connection from the JDBC pool.
> This is to cover the entire connection borrowing process (includes connection
> creation, setting up, validation, etc). The Tomcat version we are using is
> 9.0.34.
> 
> I tried playing around with the interceptors and also walked through the
> respective implementation of Tomcat[1], but couldn't find any extensible
> code segment to catch the before and after points of the get connection
> flow.
> 
> Appreciate your input on any possible solution for this.
> 
> [1]
> https://urldefense.com/v3/__https://github.com/apache/tomcat/tree/9.0.3
> 4/modules/jdbc-pool__;!!F9svGWnIaVPGSwU!6_tpBtEDTx2wg-
> 2SBU2URViWoyhQPdrSNgVO7dErbhcA1-gh-KL_EtXutKh78PSXUt86mkU$
> 
> TIA,
> Lasantha

I don't have an example on hand, but it looks like there is an MBean with the 
property meanBorrowWaitTimeMillis.  Enable JMX like this:

https://tomcat.apache.org/tomcat-9.0-doc/jdbc-pool.html#JMX


Reply via email to