java - Setting connection reference to null after closing it -
is required/good practice set connection reference null after closing it?
i closing connections in finally block.
conn.close(); conn = null; i facing connection wait timeout exception during performance testing maximum connections getting exceeded.
you'll see pattern in use when people want explicitly throw away reference, , aid garbage collection, , trigger finalisers. virtually redundant.
if conn variable used indicate new connection required (by making field, perhaps, , resetting null before later reference) that's different pattern, unrelated immediate resource management.
Comments
Post a Comment