db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kostyantyn Shchekotykhin <kos...@ifit.uni-klu.ac.at>
Subject Re: managing connetion
Date Wed, 21 Apr 2004 08:48:57 GMT
Hi All!

Scott Eade wrote:

>> 
> See the answer to question 10 in the Torque FAQ: 
> http://wiki.apache.org/db-torque/FrequentlyAskedQuestions#head-f21b65aabdf5f90c9f5df248411b7de3aab118b7
> 
i'm not sure if Thomas Fischer if right writing:
"Note that Transaction.safeRollback() does not release the database connection, so replacing
Transaction.rollback() by
transaction.safeRollback() in the above code would lead to the leakage of database connections
if the transaction fails."
here is the safeRollback method

     public static void safeRollback(Connection con)
     {
         if (con == null)
         {
             log.debug("called safeRollback with null argument");
         }
         else
         {
             try
             {
                 Transaction.rollback(con);
             }
             catch (TorqueException e)
             {
                 log.warn("An error occured during rollback.", e);
             }
         }
     }
as you can see it is doing the same as Thomas Fischer wrote in example. So IMHO users can
freely use safeRollback if 
they do not need rollback exception handling.

Regards,
Kostya

---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


Mime
View raw message