I am maintaining and existing application which is inconsistently giving Connection leakage problem. Due to the size of the application its not possible for me to go through all DAO classes and check if all connection/resultsets/statements have been closed properly.
I am thinking of writing a generic code which can analyse methods of a java/class file and see if all connection/resultsets/statements have been closed properly.
I thought of using java.lang.reflect but i think using that i can only get the method signature/params/returns type but getting into the method may not be possible.
Please me know if anyone has any idea or efficient approach of doing this rather than going through the class line by line.
If you're using Apace DBCP, then try passing "removeAbondend" & "logAbandoned" parameters to the connection string, it will collect all the not closed connection once the time out and logs the method/classes who're culprit.
Also change your display name, we don't like to call you as a "dumb dumber" ;)