dblevins 2004/09/01 17:51:57
Modified: modules/transaction/src/java/org/apache/geronimo/transaction/manager TransactionImpl.java Log: No need to log transactional boundaries when there are no resource managers to participate in a transaction. Revision Changes Path 1.9 +13 -3 incubator-geronimo/modules/transaction/src/java/org/apache/geronimo/transaction/manager/TransactionImpl.java Index: TransactionImpl.java =================================================================== RCS file: /home/cvs/incubator-geronimo/modules/transaction/src/java/org/apache/geronimo/transaction/manager/TransactionImpl.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- TransactionImpl.java 22 Jul 2004 03:39:01 -0000 1.8 +++ TransactionImpl.java 2 Sep 2004 00:51:57 -0000 1.9 @@ -213,6 +213,15 @@ // resourceManagers is now immutable } + + // no-phase + if (resourceManagers.size() == 0) { + synchronized (this) { + status = Status.STATUS_COMMITTED; + } + return; + } + // one-phase if (resourceManagers.size() == 1) { TransactionBranch manager = (TransactionBranch) resourceManagers.getFirst(); @@ -278,7 +287,6 @@ if (!rms.isEmpty()) { result = XAResource.XA_OK; } - } else { rollbackResources(rms); throw new RollbackException("Unable to commit"); @@ -325,6 +333,7 @@ //helper method used by Transaction.commit and XATerminator prepare. private boolean internalPrepare() throws SystemException { + for (Iterator rms = resourceManagers.iterator(); rms.hasNext();) { synchronized (this) { if (status != Status.STATUS_PREPARING) { @@ -346,6 +355,7 @@ } } + // decision time... boolean willCommit; synchronized (this) { @@ -356,7 +366,7 @@ } // log our decision - if (willCommit) { + if (willCommit && !resourceManagers.isEmpty()) { try { logMark = txnLog.prepare(xid, resourceManagers); } catch (LogException e) {