Author: tfischer
Date: Wed Aug 22 04:20:10 2012
New Revision: 1375893
URL: http://svn.apache.org/viewvc?rev=1375893&view=rev
Log:
fix connection handling in case that useNewConnection option is false in
idbroker
Modified:
db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/oid/IDBroker.java
Modified:
db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/oid/IDBroker.java
URL:
http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/oid/IDBroker.java?rev=1375893&r1=1375892&r2=1375893&view=diff
==============================================================================
---
db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/oid/IDBroker.java
(original)
+++
db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/oid/IDBroker.java
Wed Aug 22 04:20:10 2012
@@ -770,23 +770,26 @@ public class IDBroker implements Runnabl
}
else
{
- Connection dbCon = null;
+ boolean useNewConnection = (connection == null) || (configuration
+ .getBoolean(DB_IDBROKER_USENEWCONNECTION, true));
try
{
- if (connection == null || configuration
- .getBoolean(DB_IDBROKER_USENEWCONNECTION, true))
+ if (useNewConnection)
{
- dbCon = Transaction.begin(databaseName);
+ connection = Transaction.begin(databaseName);
}
// Read the row from the ID_TABLE.
- BigDecimal[] results = selectRow(dbCon, tableName);
+ BigDecimal[] results = selectRow(connection, tableName);
// QUANTITY column.
quantity = results[1];
quantityStore.put(tableName, quantity);
- Transaction.commit(dbCon);
- dbCon = null;
+ if (useNewConnection)
+ {
+ Transaction.commit(connection);
+ connection = null;
+ }
}
catch (Exception e)
{
@@ -794,9 +797,9 @@ public class IDBroker implements Runnabl
}
finally
{
- if (dbCon != null)
+ if (useNewConnection && connection != null)
{
- Transaction.safeRollback(dbCon);
+ Transaction.safeRollback(connection);
}
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]