0 Replies Latest reply on May 31, 2005 6:38 AM by David Carrera

    Discovering the datasource from a prepared statement

    David Carrera Newbie


      I'm trying to do a very specific live-monitoring of JBoss (still in the exploration phase). In concrete I wanna get detailed information of the amount of time a transaction thread (no clustered) is running, ready or doing I/O. To do this I use a JNI lib that is called from the server at several points. Getting CPU usage is easy (I'm using the schedstats of the linux kernel), but I'm having some problems with the I/O.

      I wanna distinguish when a thread is performing general I/O and when it's working with the DB (getting a connection from the pool or issuing queries). To do this, I 've modified the following classes/methods to call my jni lib:

      - org.jboss.resource.adapter.jdbc.WrappedPreparedStatement / execute()
      - org.jboss.resource.connectionmanager.JBossManagedConnectionPool / getConnection()

      With this I determine how much time a transaction is waiting for a connection and waiting for a DB response. With this I get some real time statistics....

      The problem is that I wanna identify the datasource pool used to access the database (I try to identify them).

      For the getConnection method, the question is easy: it's the InternalManagedConnectionPool mcp attribute. But I'm unable to know the association between a connection and a datasource pool from inside the WrappedPreparedStatement code.

      The question is, is there any "easy" way to establish this relation?

      Sorry if the explanation is confusing, but I'm desperate...

      Thanks a lot!