activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clebertsuco...@apache.org
Subject [1/2] activemq-artemis git commit: Moving XA recover methods to the OpenWireConnection
Date Fri, 01 Apr 2016 16:38:25 GMT
Repository: activemq-artemis
Updated Branches:
  refs/heads/refactor-openwire 47f735d38 -> ca1e352e3


Moving XA recover methods to the OpenWireConnection


Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/2b7acf8d
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/2b7acf8d
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/2b7acf8d

Branch: refs/heads/refactor-openwire
Commit: 2b7acf8db18b1c176355c9fdc1e65b2de1eda1d0
Parents: 47f735d
Author: Clebert Suconic <clebertsuconic@apache.org>
Authored: Fri Apr 1 10:55:18 2016 -0400
Committer: Clebert Suconic <clebertsuconic@apache.org>
Committed: Fri Apr 1 10:55:20 2016 -0400

----------------------------------------------------------------------
 .../protocol/openwire/OpenWireConnection.java     | 18 ++++++------------
 .../core/protocol/openwire/amq/AMQSession.java    |  8 --------
 .../core/server/impl/ServerSessionImpl.java       |  8 +-------
 .../artemis/core/transaction/ResourceManager.java |  3 +++
 .../transaction/impl/ResourceManagerImpl.java     | 14 ++++++++++++++
 5 files changed, 24 insertions(+), 27 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/2b7acf8d/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java
----------------------------------------------------------------------
diff --git a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java
b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java
index ab5aec1..15e9af3 100644
--- a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java
+++ b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java
@@ -107,6 +107,7 @@ import org.apache.activemq.command.ShutdownInfo;
 import org.apache.activemq.command.TransactionId;
 import org.apache.activemq.command.TransactionInfo;
 import org.apache.activemq.command.WireFormatInfo;
+import org.apache.activemq.command.XATransactionId;
 import org.apache.activemq.openwire.OpenWireFormat;
 import org.apache.activemq.state.CommandVisitor;
 import org.apache.activemq.state.ConnectionState;
@@ -1315,20 +1316,13 @@ public class OpenWireConnection extends AbstractRemotingConnection
implements Se
 
       @Override
       public Response processRecoverTransactions(TransactionInfo info) throws Exception {
-         Set<SessionId> sIds = state.getSessionIds();
-
-
+         List<Xid> xids = server.getResourceManager().getInDoubtTransactions();
          List<TransactionId> recovered = new ArrayList<>();
-         if (sIds != null) {
-            for (SessionId sid : sIds) {
-               AMQSession s = sessions.get(sid);
-               if (s != null) {
-                  s.recover(recovered);
-               }
-            }
+         for (Xid xid : xids) {
+            XATransactionId amqXid = new XATransactionId(xid);
+            recovered.add(amqXid);
          }
-
-         return new DataArrayResponse(recovered.toArray(new TransactionId[0]));
+         return new DataArrayResponse(recovered.toArray(new TransactionId[recovered.size()]));
       }
 
       @Override

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/2b7acf8d/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQSession.java
----------------------------------------------------------------------
diff --git a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQSession.java
b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQSession.java
index b71f480..1393e9b 100644
--- a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQSession.java
+++ b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQSession.java
@@ -375,14 +375,6 @@ public class AMQSession implements SessionCallback {
       return this.connection.getMarshaller();
    }
 
-   public void recover(List<TransactionId> recovered) {
-      List<Xid> xids = this.coreSession.xaGetInDoubtXids();
-      for (Xid xid : xids) {
-         XATransactionId amqXid = new XATransactionId(xid);
-         recovered.add(amqXid);
-      }
-   }
-
    public ConnectionInfo getConnectionInfo() {
       return this.connInfo;
    }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/2b7acf8d/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerSessionImpl.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerSessionImpl.java
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerSessionImpl.java
index f3dd306..31102aa 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerSessionImpl.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerSessionImpl.java
@@ -1099,13 +1099,7 @@ public class ServerSessionImpl implements ServerSession, FailureListener
{
 
    @Override
    public List<Xid> xaGetInDoubtXids() {
-      List<Xid> xids = new ArrayList<>();
-
-      xids.addAll(resourceManager.getPreparedTransactions());
-      xids.addAll(resourceManager.getHeuristicCommittedTransactions());
-      xids.addAll(resourceManager.getHeuristicRolledbackTransactions());
-
-      return xids;
+      return resourceManager.getInDoubtTransactions();
    }
 
    @Override

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/2b7acf8d/artemis-server/src/main/java/org/apache/activemq/artemis/core/transaction/ResourceManager.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/transaction/ResourceManager.java
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/transaction/ResourceManager.java
index c417a4a..5f4b240 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/transaction/ResourceManager.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/transaction/ResourceManager.java
@@ -45,4 +45,7 @@ public interface ResourceManager extends ActiveMQComponent {
 
    List<Xid> getHeuristicRolledbackTransactions();
 
+   List<Xid> getInDoubtTransactions();
+
+
 }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/2b7acf8d/artemis-server/src/main/java/org/apache/activemq/artemis/core/transaction/impl/ResourceManagerImpl.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/transaction/impl/ResourceManagerImpl.java
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/transaction/impl/ResourceManagerImpl.java
index 0db783f..d5c6491 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/transaction/impl/ResourceManagerImpl.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/transaction/impl/ResourceManagerImpl.java
@@ -21,6 +21,7 @@ import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
+import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -161,6 +162,19 @@ public class ResourceManagerImpl implements ResourceManager {
       return -1;
    }
 
+   @Override
+   public List<Xid> getInDoubtTransactions()
+   {
+      List<Xid> xids = new LinkedList<>();
+
+      xids.addAll(getPreparedTransactions());
+      xids.addAll(getHeuristicCommittedTransactions());
+      xids.addAll(getHeuristicRolledbackTransactions());
+
+      return xids;
+   }
+
+
    private List<Xid> getHeuristicCompletedTransactions(final boolean isCommit) {
       List<Xid> xids = new ArrayList<>();
       for (HeuristicCompletionHolder holder : heuristicCompletions) {


Mime
View raw message