You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by cl...@apache.org on 2017/07/28 14:33:47 UTC

[1/2] activemq-artemis git commit: This closes #1426

Repository: activemq-artemis
Updated Branches:
  refs/heads/master 40534b29d -> 2428c9ca1


This closes #1426


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

Branch: refs/heads/master
Commit: 2428c9ca1c85c97decf665c7d0e142d29b24fff4
Parents: 40534b2 54d220e
Author: Clebert Suconic <cl...@apache.org>
Authored: Fri Jul 28 10:33:40 2017 -0400
Committer: Clebert Suconic <cl...@apache.org>
Committed: Fri Jul 28 10:33:40 2017 -0400

----------------------------------------------------------------------
 .../artemis/ra/ActiveMQRAManagedConnection.java | 41 ++++++++++++++++++--
 1 file changed, 37 insertions(+), 4 deletions(-)
----------------------------------------------------------------------



[2/2] activemq-artemis git commit: ARTEMIS-1305 Server frozen during shutdown on Resource Adapter

Posted by cl...@apache.org.
ARTEMIS-1305 Server frozen during shutdown on Resource Adapter

this is a better fix than the previous one


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

Branch: refs/heads/master
Commit: 54d220edf309647d3f9e17854ebbda7a984dfedf
Parents: 40534b2
Author: Clebert Suconic <cl...@apache.org>
Authored: Fri Jul 28 09:38:19 2017 -0400
Committer: Clebert Suconic <cl...@apache.org>
Committed: Fri Jul 28 10:33:40 2017 -0400

----------------------------------------------------------------------
 .../artemis/ra/ActiveMQRAManagedConnection.java | 41 ++++++++++++++++++--
 1 file changed, 37 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/54d220ed/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAManagedConnection.java
----------------------------------------------------------------------
diff --git a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAManagedConnection.java b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAManagedConnection.java
index e53c3fd..eee41cc 100644
--- a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAManagedConnection.java
+++ b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAManagedConnection.java
@@ -221,6 +221,14 @@ public final class ActiveMQRAManagedConnection implements ManagedConnection, Exc
          ActiveMQRALogger.LOGGER.trace("destroyHandles()");
       }
 
+      try {
+         if (connection != null) {
+            connection.stop();
+         }
+      } catch (Throwable t) {
+         logger.trace("Ignored error stopping connection", t);
+      }
+
       for (ActiveMQRASession session : handles) {
          session.destroy();
       }
@@ -255,7 +263,10 @@ public final class ActiveMQRAManagedConnection implements ManagedConnection, Exc
       }
 
       try {
-         connectionFactory.close();
+         // we must close the ActiveMQConnectionFactory because it contains a ServerLocator
+         if (connectionFactory != null) {
+            ra.closeConnectionFactory(mcf.getProperties());
+         }
       } catch (Exception e) {
          logger.debug(e.getMessage(), e);
       }
@@ -263,10 +274,32 @@ public final class ActiveMQRAManagedConnection implements ManagedConnection, Exc
       destroyHandles();
 
       try {
-         // we must close the ActiveMQConnectionFactory because it contains a ServerLocator
-         if (connectionFactory != null) {
-            ra.closeConnectionFactory(mcf.getProperties());
+         // The following calls should not be necessary, as the connection should close the
+         // ClientSessionFactory, which will close the sessions.
+         try {
+            /**
+             * (xa|nonXA)Session.close() may NOT be called BEFORE connection.close()
+             * <p>
+             * If the ClientSessionFactory is trying to fail-over or reconnect with -1 attempts, and
+             * one calls session.close() it may effectively dead-lock.
+             * <p>
+             * connection close will close the ClientSessionFactory which will close all sessions.
+             */
+            if (connection != null) {
+               connection.close();
+            }
+
+            if (nonXAsession != null) {
+               nonXAsession.close();
+            }
+
+            if (xaSession != null) {
+               xaSession.close();
+            }
+         } catch (JMSException e) {
+            ActiveMQRALogger.LOGGER.debug("Error closing session " + this, e);
          }
+
       } catch (Throwable e) {
          throw new ResourceException("Could not properly close the session and connection", e);
       }