tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ralph Einfeldt" <ralph.einfe...@uptime-isc.de>
Subject AW: problem with connections not closing...
Date Tue, 11 Jun 2002 14:30:14 GMT
The finalize method migth not be called until tomcat is shut down.
Recommended actions:
- Use a connection pool
- Request the connection as close as possible to the usage
- Return the connection as soon as possible after the usage
- Always use a pattern like 
  Connection mCon = null;
  try {
    mCon = mPool.getConnection(); 
    // The exact code depends on the implemenation of the pool
  } catch (...) {
  } finally {
    mPool.releaseConnection(mCon);
    // The exact code depends on the implemenation of the pool
    // if you have to catch Exception or to make shure that
    // mCon != null and if you need transactions
  }

> -----Urspr√ľngliche Nachricht-----
> Von: Christian J. Dechery [mailto:christian@finep.gov.br]
> Gesendet: Dienstag, 11. Juni 2002 15:33
> An: tomcat-user@jakarta.apache.org
> Betreff: problem with connections not closing...
> 
> I've even debugged it, there are some JSPs that opens like 4 
> connections, and in my finalize() method there's a 
> con.close() call, never all the 4 con.close() are 
> successfull, there's always at least one that fails and gives 
> an execption. I don't know why.

--
To unsubscribe, e-mail:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-user-help@jakarta.apache.org>


Mime
View raw message