Author: michiel Date: 2010-02-18 14:34:11 +0100 (Thu, 18 Feb 2010) New Revision: 41134
Modified: mmbase/trunk/core/src/main/java/org/mmbase/storage/implementation/database/DatabaseStorageManager.java Log: Fix for MMB-1915 was not quite correct Modified: mmbase/trunk/core/src/main/java/org/mmbase/storage/implementation/database/DatabaseStorageManager.java =================================================================== --- mmbase/trunk/core/src/main/java/org/mmbase/storage/implementation/database/DatabaseStorageManager.java 2010-02-18 13:33:21 UTC (rev 41133) +++ mmbase/trunk/core/src/main/java/org/mmbase/storage/implementation/database/DatabaseStorageManager.java 2010-02-18 13:34:11 UTC (rev 41134) @@ -195,6 +195,7 @@ return verifyTables; } + /** * Obtains an active connection, opening a new one if needed. * This method sets and then returns the {...@link #activeConnection} member. @@ -211,6 +212,7 @@ } } activeConnection = factory.getDataSource().getConnection(); + // set autocommit to true if (activeConnection != null) { activeConnection.setAutoCommit(true); @@ -235,6 +237,8 @@ log.error("Failure when closing connection: " + se.getMessage()); } activeConnection = null; + } else { + log.debug("No connection to release " + activeConnection + " " + inTransaction); } @@ -248,12 +252,15 @@ if (factory.supportsTransactions()) { try { getActiveConnection(); - if (activeConnection == null) return; + if (activeConnection == null) { + log.debug("No active connection got"); + return; + } activeConnection.setTransactionIsolation(transactionIsolation); activeConnection.setAutoCommit(false); } catch (SQLException se) { + inTransaction = false; releaseActiveConnection(); - inTransaction = false; throw new StorageException(se); } } @@ -282,6 +289,9 @@ releaseActiveConnection(); factory.getChangeManager().commit(changes); } + log.debug("Commited"); + } else { + log.debug("Transactions not supported"); } } } @@ -291,16 +301,19 @@ if (!inTransaction) { throw new StorageException("No transaction started."); } else { - inTransaction = false; if (factory.supportsTransactions()) { try { activeConnection.rollback(); } catch (SQLException se) { throw new StorageException(se); } finally { + inTransaction = false; releaseActiveConnection(); changes.clear(); } + log.debug("Rolled back"); + } else { + log.debug("Transactions not supported"); } return factory.supportsTransactions(); } _______________________________________________ Cvs mailing list Cvs@lists.mmbase.org http://lists.mmbase.org/mailman/listinfo/cvs