Just want to share my experience and hope that would help others.

Now I wrote my own class to do the monitoring job. I found that the Connection 
objects created by the datasource 
(org.jboss.pool.jdbc.xa.wrapper.XADataSourceImpl) are in fact 
org.jboss.pool.jdbc.xa.wrapper.XAConnectionImpl instances. XAConnectionImpl 
implements the interfaces javax.sql.PooledConnection and 
org.jboss.pool.PooledObject.
And these 2 interfaces fire events for listeners to catch. So I made use of the 
listeners API to monitor the connection activity.

I extended the datasource XADataSourceImpl. Everytime MyXADataSourceImpl 
creates a new Connection, it adds a javax.sql.ConnectionEventListener and a 
org.jboss.pool.PoolEventListener to the lister-list of the Connection object. 
Although these 2 listeners do not actually catch the connection-fetched event, 
they catch the connection-used and connection-closed events. And this is enough 
to virtually catch the connection-fetched event.

Well, I would say this is not a very good approach. It adds extra classes to 
the app server, and it might not apply to other apps using other DataSource 
classes. But it served my purpose with least impact to the app (just put the 
extra jar under the classpath, and switch the DataSource in jboss.jcml).

Any better solution would still be appreciated.

View the original post : 
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3876002#3876002

Reply to the post : 
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3876002


-------------------------------------------------------
This SF.Net email is sponsored by: NEC IT Guy Games.
Get your fingers limbered up and give it your best shot. 4 great events, 4
opportunities to win big! Highest score wins.NEC IT Guy Games. Play to
win an NEC 61 plasma display. Visit http://www.necitguy.com/?r=20
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to