geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r939929 - in /geronimo/components/txmanager/trunk: ./ geronimo-transaction/src/main/java/org/apache/geronimo/transaction/manager/
Date Sat, 01 May 2010 06:30:09 GMT
Author: djencks
Date: Sat May  1 06:30:09 2010
New Revision: 939929

URL: http://svn.apache.org/viewvc?rev=939929&view=rev
Log:
GERONIMO-5152 restore logic about results of a heuristic rollback. Clean up pom

Modified:
    geronimo/components/txmanager/trunk/geronimo-transaction/src/main/java/org/apache/geronimo/transaction/manager/CommitTask.java
    geronimo/components/txmanager/trunk/geronimo-transaction/src/main/java/org/apache/geronimo/transaction/manager/TransactionImpl.java
    geronimo/components/txmanager/trunk/pom.xml

Modified: geronimo/components/txmanager/trunk/geronimo-transaction/src/main/java/org/apache/geronimo/transaction/manager/CommitTask.java
URL: http://svn.apache.org/viewvc/geronimo/components/txmanager/trunk/geronimo-transaction/src/main/java/org/apache/geronimo/transaction/manager/CommitTask.java?rev=939929&r1=939928&r2=939929&view=diff
==============================================================================
--- geronimo/components/txmanager/trunk/geronimo-transaction/src/main/java/org/apache/geronimo/transaction/manager/CommitTask.java
(original)
+++ geronimo/components/txmanager/trunk/geronimo-transaction/src/main/java/org/apache/geronimo/transaction/manager/CommitTask.java
Sat May  1 06:30:09 2010
@@ -48,6 +48,7 @@ public class CommitTask implements Runna
     private int count = 0;
     private int status;
     private XAException cause;
+    private boolean evercommit;
 
     public CommitTask(Xid xid, List<TransactionBranch> rms, Object logMark, RetryScheduler
retryScheduler, TransactionLog txLog) {
         this.xid = xid;
@@ -80,11 +81,13 @@ public class CommitTask implements Runna
                         i.remove();
                         log.info("Transaction has been heuristically committed and rolled
back");
                         cause = e;
+                        evercommit = true;
                         manager.getCommitter().forget(manager.getBranchId());
                     } else if (e.errorCode == XAException.XA_HEURCOM) {
                         i.remove();
                         // let's not throw an exception as the transaction has been committed
                         log.info("Transaction has been heuristically committed");
+                        evercommit = true;
                         manager.getCommitter().forget(manager.getBranchId());
                     } else if (e.errorCode == XAException.XA_RETRY) {
                         // do nothing, retry later
@@ -117,23 +120,16 @@ public class CommitTask implements Runna
         } else {
             retryScheduler.retry(this, count++);
         }
-//        if (cause != null) {
-//            if (cause.errorCode == XAException.XA_HEURRB && !evercommit) {
-//                throw (HeuristicRollbackException) new HeuristicRollbackException("Error
during two phase commit").initCause(cause);
-//            } else if (cause.errorCode == XAException.XA_HEURRB && evercommit)
{
-//                throw (HeuristicMixedException) new HeuristicMixedException("Error during
two phase commit").initCause(cause);
-//            } else if (cause.errorCode == XAException.XA_HEURMIX) {
-//                throw (HeuristicMixedException) new HeuristicMixedException("Error during
two phase commit").initCause(cause);
-//            } else {
-//                throw (SystemException) new SystemException("Error during two phase commit").initCause(cause);
-//            }
-//        }
     }
 
     public XAException getCause() {
         return cause;
     }
 
+    public boolean isEvercommit() {
+        return evercommit;
+    }
+
     public int getStatus() {
         return status;
     }

Modified: geronimo/components/txmanager/trunk/geronimo-transaction/src/main/java/org/apache/geronimo/transaction/manager/TransactionImpl.java
URL: http://svn.apache.org/viewvc/geronimo/components/txmanager/trunk/geronimo-transaction/src/main/java/org/apache/geronimo/transaction/manager/TransactionImpl.java?rev=939929&r1=939928&r2=939929&view=diff
==============================================================================
--- geronimo/components/txmanager/trunk/geronimo-transaction/src/main/java/org/apache/geronimo/transaction/manager/TransactionImpl.java
(original)
+++ geronimo/components/txmanager/trunk/geronimo-transaction/src/main/java/org/apache/geronimo/transaction/manager/TransactionImpl.java
Sat May  1 06:30:09 2010
@@ -746,7 +746,6 @@ public class TransactionImpl implements 
     }
     
     private void commitResources(List<TransactionBranch> rms) throws HeuristicRollbackException,
HeuristicMixedException, SystemException {
-        //TODO there's some logic removed about dealing with a heuristic rollback on the
first resource.
         CommitTask commitTask = new CommitTask(xid, rms, logMark, retryScheduler, txnLog);
         synchronized (this) {
             status = Status.STATUS_COMMITTING;
@@ -756,10 +755,11 @@ public class TransactionImpl implements 
             status = commitTask.getStatus();
         }
         XAException cause = commitTask.getCause();
+        boolean evercommit = commitTask.isEvercommit();
         if (cause != null) {
-            if (cause.errorCode == XAException.XA_HEURRB) {
+            if (cause.errorCode == XAException.XA_HEURRB&& !evercommit) {
                 throw (HeuristicRollbackException) new HeuristicRollbackException("Error
during two phase commit").initCause(cause);
-            } else if (cause.errorCode == XAException.XA_HEURRB) {
+            } else if (cause.errorCode == XAException.XA_HEURRB && evercommit) {
                 throw (HeuristicMixedException) new HeuristicMixedException("Error during
two phase commit").initCause(cause);
             } else if (cause.errorCode == XAException.XA_HEURMIX) {
                 throw (HeuristicMixedException) new HeuristicMixedException("Error during
two phase commit").initCause(cause);
@@ -769,67 +769,6 @@ public class TransactionImpl implements 
         }
 
 
-//        XAException cause = null;
-//        boolean evercommit = false;
-//        try {
-//            for (Iterator i = rms.iterator(); i.hasNext();) {
-//                TransactionBranch manager = (TransactionBranch) i.next();
-//                try {
-//                    manager.getCommitter().commit(manager.getBranchId(), false);
-//                    evercommit = true;
-//                } catch (XAException e) {
-//                    log.error("Unexpected exception committing " + manager.getCommitter()
+ "; continuing to commit other RMs", e);
-//
-//                    if (e.errorCode == XAException.XA_HEURRB) {
-//                        log.info("Transaction has been heuristically rolled back");
-//                        cause = e;
-//                        manager.getCommitter().forget(manager.getBranchId());
-//                    } else if (e.errorCode == XAException.XA_HEURMIX) {
-//                        log.info("Transaction has been heuristically committed and rolled
back");
-//                        cause = e;
-//                        evercommit = true;
-//                        manager.getCommitter().forget(manager.getBranchId());
-//                    } else if (e.errorCode == XAException.XA_HEURCOM) {
-//                        // let's not throw an exception as the transaction has been committed
-//                        log.info("Transaction has been heuristically committed");
-//                        evercommit = true;
-//                        manager.getCommitter().forget(manager.getBranchId());
-//                    } else {
-//                        cause = e;
-//                    }
-//                }
-//            }
-//        } catch (XAException e) {
-//            if (e.errorCode == XAException.XAER_NOTA) {
-//                // NOTA in response to forget, means the resource already forgot the transaction
-//                // ignore
-//            } else {
-//                throw (SystemException) new SystemException("Error during two phase commit").initCause(e);
-//            }
-//        }
-//        //if all resources were read only, we didn't write a prepare record.
-//        if (!rms.isEmpty()) {
-//            try {
-//                txnLog.commit(xid, logMark);
-//            } catch (LogException e) {
-//                log.error("Unexpected exception logging commit completion for xid " + xid,
e);
-//                throw (SystemException) new SystemException("Unexpected error logging commit
completion for xid " + xid).initCause(e);
-//            }
-//        }
-//        synchronized (this) {
-//            status = Status.STATUS_COMMITTED;
-//        }
-//        if (cause != null) {
-//            if (cause.errorCode == XAException.XA_HEURRB && !evercommit) {
-//                throw (HeuristicRollbackException) new HeuristicRollbackException("Error
during two phase commit").initCause(cause);
-//            } else if (cause.errorCode == XAException.XA_HEURRB && evercommit)
{
-//                throw (HeuristicMixedException) new HeuristicMixedException("Error during
two phase commit").initCause(cause);
-//            } else if (cause.errorCode == XAException.XA_HEURMIX) {
-//                throw (HeuristicMixedException) new HeuristicMixedException("Error during
two phase commit").initCause(cause);
-//            } else {
-//                throw (SystemException) new SystemException("Error during two phase commit").initCause(cause);
-//            }
-//        }
     }
 
     private static String getStateString(int status) {

Modified: geronimo/components/txmanager/trunk/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/components/txmanager/trunk/pom.xml?rev=939929&r1=939928&r2=939929&view=diff
==============================================================================
--- geronimo/components/txmanager/trunk/pom.xml (original)
+++ geronimo/components/txmanager/trunk/pom.xml Sat May  1 06:30:09 2010
@@ -49,6 +49,19 @@
 
     <dependencyManagement>
         <dependencies>
+            <!-- INTERNAL -->
+
+            <dependency>
+                <groupId>org.apache.geronimo.components</groupId>
+                <artifactId>geronimo-transaction</artifactId>
+                <version>${version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.geronimo.components</groupId>
+                <artifactId>geronimo-connector</artifactId>
+                <version>${version}</version>
+            </dependency>
+            <!-- external -->
             <dependency>
                 <groupId>org.slf4j</groupId>
                 <artifactId>slf4j-api</artifactId>
@@ -71,7 +84,7 @@
             <dependency>
                 <groupId>org.apache.geronimo.specs</groupId>
                 <artifactId>geronimo-j2ee-connector_1.6_spec</artifactId>
-                <version>1.0-EA-SNAPSHOT</version>
+                <version>1.0</version>
             </dependency>
 
             <dependency>
@@ -87,13 +100,6 @@
                 <scope>test</scope>
             </dependency>
 
-            <!-- INTERNAL -->
-
-            <dependency>
-                <groupId>org.apache.geronimo.components</groupId>
-                <artifactId>geronimo-transaction</artifactId>
-                <version>${version}</version>
-            </dependency>
         </dependencies>
     </dependencyManagement>
 



Mime
View raw message