geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From esh...@apache.org
Subject [geode] branch feature/GEODE-7130 updated: feature/GEODE-7130: rollback the timed out and expired transaction.
Date Mon, 26 Aug 2019 19:54:10 GMT
This is an automated email from the ASF dual-hosted git repository.

eshu11 pushed a commit to branch feature/GEODE-7130
in repository https://gitbox.apache.org/repos/asf/geode.git


The following commit(s) were added to refs/heads/feature/GEODE-7130 by this push:
     new 26ce9ea  feature/GEODE-7130: rollback the timed out and expired transaction.
26ce9ea is described below

commit 26ce9eafc8f362bf1b42b1a97304280d2e19b8c7
Author: eshu <eshu@pivotal.io>
AuthorDate: Mon Aug 26 12:52:55 2019 -0700

    feature/GEODE-7130: rollback the timed out and expired transaction.
---
 .../java/org/apache/geode/internal/jta/GlobalTransaction.java     | 3 ++-
 .../org/apache/geode/internal/jta/TransactionManagerImpl.java     | 8 ++++++--
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/geode-core/src/main/java/org/apache/geode/internal/jta/GlobalTransaction.java
b/geode-core/src/main/java/org/apache/geode/internal/jta/GlobalTransaction.java
index 9d25e5d..a123497 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/jta/GlobalTransaction.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/jta/GlobalTransaction.java
@@ -623,7 +623,8 @@ public class GlobalTransaction {
     try {
       if (writer.infoEnabled())
         writer.info(String.format("Transaction %s has timed out.", this));
-      TransactionManagerImpl.getTransactionManager().removeTranxnMappings(transactions);
+      TransactionManagerImpl.getTransactionManager()
+          .removeTranxnMappingsAndRollbackExpiredTransaction(transactions);
       setStatus(Status.STATUS_NO_TRANSACTION);
     } catch (Exception e) {
       if (writer.severeEnabled())
diff --git a/geode-core/src/main/java/org/apache/geode/internal/jta/TransactionManagerImpl.java
b/geode-core/src/main/java/org/apache/geode/internal/jta/TransactionManagerImpl.java
index 6eafedd..ad7e913 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/jta/TransactionManagerImpl.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/jta/TransactionManagerImpl.java
@@ -754,7 +754,7 @@ public class TransactionManagerImpl implements TransactionManager, Serializable
     }
   }
 
-  void removeTranxnMappings(List tranxns) {
+  void removeTranxnMappingsAndRollbackExpiredTransaction(List tranxns) {
     Object[] threads = transactionMap.keySet().toArray();
     int len = threads.length;
     Object tx = null;
@@ -765,7 +765,11 @@ public class TransactionManagerImpl implements TransactionManager, Serializable
       removed = tranxns.remove(tx);
       if (removed) {
         transactionMap.remove(temp);
-        globalTransactionMap.remove(tx);
+        GlobalTransaction globalTransaction = (GlobalTransaction) globalTransactionMap.remove(tx);
+        try {
+          globalTransaction.rollback();
+        } catch (Exception ignore) {
+        }
       }
     }
   }


Mime
View raw message