You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by db...@apache.org on 2011/04/28 19:22:06 UTC

svn commit: r1097555 - in /geronimo/components/txmanager/branches/geronimo-txmanager-parent-2.2/geronimo-transaction/src/main/java/org/apache/geronimo/transaction/manager: SetRollbackOnlyException.java TransactionImpl.java

Author: dblevins
Date: Thu Apr 28 17:22:05 2011
New Revision: 1097555

URL: http://svn.apache.org/viewvc?rev=1097555&view=rev
Log:
GERONIMO-4576 and OPENEJB-782
Record the orgigin of setRollbackOnly calls

Added:
    geronimo/components/txmanager/branches/geronimo-txmanager-parent-2.2/geronimo-transaction/src/main/java/org/apache/geronimo/transaction/manager/SetRollbackOnlyException.java   (with props)
Modified:
    geronimo/components/txmanager/branches/geronimo-txmanager-parent-2.2/geronimo-transaction/src/main/java/org/apache/geronimo/transaction/manager/TransactionImpl.java

Added: geronimo/components/txmanager/branches/geronimo-txmanager-parent-2.2/geronimo-transaction/src/main/java/org/apache/geronimo/transaction/manager/SetRollbackOnlyException.java
URL: http://svn.apache.org/viewvc/geronimo/components/txmanager/branches/geronimo-txmanager-parent-2.2/geronimo-transaction/src/main/java/org/apache/geronimo/transaction/manager/SetRollbackOnlyException.java?rev=1097555&view=auto
==============================================================================
--- geronimo/components/txmanager/branches/geronimo-txmanager-parent-2.2/geronimo-transaction/src/main/java/org/apache/geronimo/transaction/manager/SetRollbackOnlyException.java (added)
+++ geronimo/components/txmanager/branches/geronimo-txmanager-parent-2.2/geronimo-transaction/src/main/java/org/apache/geronimo/transaction/manager/SetRollbackOnlyException.java Thu Apr 28 17:22:05 2011
@@ -0,0 +1,27 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.geronimo.transaction.manager;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class SetRollbackOnlyException extends Exception {
+
+    public SetRollbackOnlyException() {
+        super("setRollbackOnly() called.  See stacktrace for origin");
+    }
+}

Propchange: geronimo/components/txmanager/branches/geronimo-txmanager-parent-2.2/geronimo-transaction/src/main/java/org/apache/geronimo/transaction/manager/SetRollbackOnlyException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: geronimo/components/txmanager/branches/geronimo-txmanager-parent-2.2/geronimo-transaction/src/main/java/org/apache/geronimo/transaction/manager/TransactionImpl.java
URL: http://svn.apache.org/viewvc/geronimo/components/txmanager/branches/geronimo-txmanager-parent-2.2/geronimo-transaction/src/main/java/org/apache/geronimo/transaction/manager/TransactionImpl.java?rev=1097555&r1=1097554&r2=1097555&view=diff
==============================================================================
--- geronimo/components/txmanager/branches/geronimo-txmanager-parent-2.2/geronimo-transaction/src/main/java/org/apache/geronimo/transaction/manager/TransactionImpl.java (original)
+++ geronimo/components/txmanager/branches/geronimo-txmanager-parent-2.2/geronimo-transaction/src/main/java/org/apache/geronimo/transaction/manager/TransactionImpl.java Thu Apr 28 17:22:05 2011
@@ -123,10 +123,15 @@ public class TransactionImpl implements 
     }
 
     public synchronized void setRollbackOnly() throws IllegalStateException {
+        setRollbackOnly(new SetRollbackOnlyException());
+    }
+
+    public synchronized void setRollbackOnly(Exception reason) {
         switch (status) {
             case Status.STATUS_ACTIVE:
             case Status.STATUS_PREPARING:
                 status = Status.STATUS_MARKED_ROLLBACK;
+                markRollbackCause(reason);
                 break;
             case Status.STATUS_MARKED_ROLLBACK:
             case Status.STATUS_ROLLING_BACK:
@@ -209,7 +214,7 @@ public class TransactionImpl implements 
         } catch (XAException e) {
             log.warn("Unable to enlist XAResource " + xaRes + ", errorCode: " + e.errorCode, e);
             // mark status as rollback only because enlist resource failed
-            setRollbackOnly();
+            setRollbackOnly(e);
             return false;
         }
     }