How to check connection leak using regular expression ?
Posted
by gauravkarnatak
on Stack Overflow
See other posts from Stack Overflow
or by gauravkarnatak
Published on 2010-04-21T10:15:17Z
Indexed on
2010/04/21
10:23 UTC
Read the original article
Hit count: 278
I have to check connection leak in my application i.e. open connections which have not been closed.
After searching, after I found out that a thousands times connections have been opened but I can't manually go to each and every code fragment and check for connection close thing.
I think, it could be possible using a regular expression but the fact is, I am not that well versed with regex that I could write one.
Please suggest a regular expression for checking in a no of java files that a opened connection has been closed or not.
My code pattern is something like this.
try {
/*
Some code goes here
*/
con = EJBUtil.getConnection(JNDI_NAME);
/*
Some code goes here
*/
}
finally
{
/*
Some code goes here
*/
DBUtil.close(con);
or
closeConnection.close(con);
/*
Some code goes here
*/
}
© Stack Overflow or respective owner