I want to know if there exists an annotation or object that gets the open connections in JBoss so they can be closed, and so avoid leaks in the situation where I kill a thread that still has connections opened. I’m using JBoss 4.2.3.
Thanks for your help.
It’s unlikely there will be an annotation or object that will hold all open connections, as this could be very tricky from a security standpoint.
I understand managing leaky applications can be a bit of an emergency, so if you just need a quick win, an AspectJ pointcut that finds all open connections that haven’t been closed within a certain period of time might be useful. I haven’t actually tried it, but this might be useful:
http://www.ibm.com/developerworks/java/library/j-aopwork10/
Alternatively, a decent profiler can go a long way (JProfiler is what I use and recommend at the moment).