On Monday, October 21, 2002, at 04:50  pm, Peter S. Hamlen wrote:

But the most common source of connection pool leaks is if you throw an
exception in the middle of a routine and therefore don't call commit or
rollback on the connection.
It's worth writing something like:

Connection conn = Transaction.begin(<TablePeer>.DATABASE_NAME);
boolean success = false;
try {
blah blah blah
Transaction.commit(conn);
success = true;
} finally {
if (!success) Transaction.safeRollback(conn);
}

that way you always either commit or rollback every time.

---
Development Team Leader, eGS, 5-7 Singer Street, London EC2A 4BQ. +44 (0)20 7336 1440

CONFIDENTIALITY: This is email is confidential and intended solely for the use of the individual to whom it is addressed.� Any views or opinions presented are solely those of the author and do not necessarily represent those of eGovernment Solutions (UK) Ltd.� If you are not the intended recipient, be advised that you have received this email in error and that any use, dissemination, forwarding, or copying of this email is strictly prohibited.� If you have received this email in error please contact the sender.


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



Reply via email to