Hi John,

Thanks for your suggestion on the JMX approach. But as per my requirement,
using JMX to get the connection time will not be a viable solution.

My exact requirement is to log down individual connection establishment
time for each JDBC connection which is related to specific message flow. So
in this case, we won't be able to open up JMX (due to security concerns),
and also we will not be able to track down each JDBC connection object and
get the individual connection establishment time.

Thanks & Regards,

*Lasantha Samarakoon*
M: +94 (71) 214 1576 | E: [email protected]


On Tue, Sep 7, 2021 at 7:34 PM <[email protected]> wrote:

> Lasantha,
>
>
> > -----Original Message-----
> > From: Lasantha Samarakoon <[email protected]>
> > Sent: Monday, September 06, 2021 10:22 PM
> > To: [email protected]
> > 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