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

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -