I have a connection pool. In the getConnection()
method I poll a connection from the queue to a variable and check whether it is closed by isClosed()
method. If it is closed I set to the variable new connection by DriverManager.getConnection(url, user, password)
method.
The question is: do I need to close the connection mannualy by close()
method before rewriting the varible to ensure that the connection will be collected by the Garbage Collector?