Repository: activemq-artemis
Updated Branches:
  refs/heads/master 9765dadbc -> 2ddaa0aa8


NO-JIRA Partially Revert "NO-JIRA Removing Wrong assertion"

I have changed ActiveMQActivation by mistake here at 
385e11117b1f62803e999e602b952ad68b79a7c3


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

Branch: refs/heads/master
Commit: 2ddaa0aa86be69140debb5477d9fbd3f4301a8dc
Parents: 9765dad
Author: Clebert Suconic <[email protected]>
Authored: Wed May 2 21:35:17 2018 -0400
Committer: Clebert Suconic <[email protected]>
Committed: Wed May 2 21:38:12 2018 -0400

----------------------------------------------------------------------
 .../artemis/ra/inflow/ActiveMQActivation.java   | 38 ++++++++++++++++++--
 1 file changed, 35 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/2ddaa0aa/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/inflow/ActiveMQActivation.java
----------------------------------------------------------------------
diff --git 
a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/inflow/ActiveMQActivation.java
 
b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/inflow/ActiveMQActivation.java
index e527352..ede1b01 100644
--- 
a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/inflow/ActiveMQActivation.java
+++ 
b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/inflow/ActiveMQActivation.java
@@ -390,8 +390,24 @@ public class ActiveMQActivation {
          }
       }
 
-      for (ActiveMQMessageHandler handler : handlersCopy) {
-         handler.teardown();
+      Thread threadTearDown = new Thread("TearDown/ActiveMQActivation") {
+         @Override
+         public void run() {
+            for (ActiveMQMessageHandler handler : handlersCopy) {
+               handler.teardown();
+            }
+         }
+      };
+
+      // We will first start a new thread that will call tearDown on all the 
instances, trying to graciously shutdown everything.
+      // We will then use the call-timeout to determine a timeout.
+      // if that failed we will then close the connection factory, and 
interrupt the thread
+      threadTearDown.start();
+
+      try {
+         threadTearDown.join(timeout);
+      } catch (InterruptedException e) {
+         // nothing to be done on this context.. we will just keep going as we 
need to send an interrupt to threadTearDown and give up
       }
 
       if (factory != null) {
@@ -405,6 +421,20 @@ public class ActiveMQActivation {
          factory = null;
       }
 
+      if (threadTearDown.isAlive()) {
+         threadTearDown.interrupt();
+
+         try {
+            threadTearDown.join(5000);
+         } catch (InterruptedException e) {
+            // nothing to be done here.. we are going down anyways
+         }
+
+         if (threadTearDown.isAlive()) {
+            
ActiveMQRALogger.LOGGER.threadCouldNotFinish(threadTearDown.toString());
+         }
+      }
+
       nodes.clear();
       lastReceived = false;
 
@@ -518,7 +548,9 @@ public class ActiveMQActivation {
                   calculatedDestinationName = spec.getQueuePrefix() + 
calculatedDestinationName;
                }
 
-               logger.debug("Unable to retrieve " + destinationName + " from 
JNDI. Creating a new " + destinationType.getName() + " named " + 
calculatedDestinationName + " to be used by the MDB.");
+               logger.debug("Unable to retrieve " + destinationName +
+                                                " from JNDI. Creating a new " 
+ destinationType.getName() +
+                                                " named " + 
calculatedDestinationName + " to be used by the MDB.");
 
                // If there is no binding on naming, we will just create a new 
instance
                if (isTopic) {

Reply via email to