[hornetq-commits] JBoss hornetq SVN: r9125 - in trunk: tests/src/org/hornetq/tests/integration/jms/bridge and 1 other directory.

do-not-reply at jboss.org do-not-reply at jboss.org
Thu Apr 15 10:04:53 EDT 2010


Author: jmesnil
Date: 2010-04-15 10:04:52 -0400 (Thu, 15 Apr 2010)
New Revision: 9125

Modified:
   trunk/src/main/org/hornetq/jms/bridge/impl/JMSBridgeImpl.java
   trunk/tests/src/org/hornetq/tests/integration/jms/bridge/JMSBridgeReconnectionTest.java
Log:
https://jira.jboss.org/jira/browse/HORNETQ-287: cannot stop JMSBridge which is handling startup failure

* reverted buggy fix

Modified: trunk/src/main/org/hornetq/jms/bridge/impl/JMSBridgeImpl.java
===================================================================
--- trunk/src/main/org/hornetq/jms/bridge/impl/JMSBridgeImpl.java	2010-04-15 13:41:16 UTC (rev 9124)
+++ trunk/src/main/org/hornetq/jms/bridge/impl/JMSBridgeImpl.java	2010-04-15 14:04:52 UTC (rev 9125)
@@ -19,9 +19,6 @@
 import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.Map;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.TimeUnit;
 
 import javax.jms.Connection;
 import javax.jms.ConnectionFactory;
@@ -53,7 +50,6 @@
 import org.hornetq.jms.bridge.JMSBridgeControl;
 import org.hornetq.jms.bridge.QualityOfServiceMode;
 import org.hornetq.jms.client.HornetQSession;
-import org.hornetq.utils.Future;
 
 /**
  * 
@@ -112,8 +108,6 @@
 
    private boolean started;
 
-   private volatile boolean stopping = false;
-
    private final LinkedList<Message> messages;
 
    private ConnectionFactoryFactory sourceCff;
@@ -170,8 +164,6 @@
 
    private static final int FORWARD_MODE_NONTX = 2;
 
-   private ExecutorService executor;
-   
    /*
     * Constructor for MBean
     */
@@ -278,8 +270,6 @@
 
       checkParams();
 
-      this.executor = Executors.newSingleThreadExecutor();
-      
       if (mbeanServer != null)
       {
          if (objectName != null)
@@ -315,8 +305,6 @@
 
    public synchronized void start() throws Exception
    {
-      stopping = false; 
-
       if (started)
       {
          JMSBridgeImpl.log.warn("Attempt to start, but is already started");
@@ -368,19 +356,20 @@
 
             timeChecker = new BatchTimeChecker();
 
-            Thread checkerThread = new Thread(timeChecker, "jmsbridge-checker-thread");
-            checkerThread.start();
-            
+            checkerThread = new Thread(timeChecker, "jmsbridge-checker-thread");
+
             batchExpiryTime = System.currentTimeMillis() + maxBatchTime;
 
+            checkerThread.start();
+
             if (JMSBridgeImpl.trace)
             {
                JMSBridgeImpl.log.trace("Started time checker thread");
             }
          }
 
-         Thread sourceThread = new SourceReceiver();
-         sourceThread.start();
+         sourceReceiver = new SourceReceiver();
+         sourceReceiver.start();
 
          if (JMSBridgeImpl.trace)
          {
@@ -397,7 +386,11 @@
 
    public synchronized void stop() throws Exception
    {
-      stopping = true;
+      if (!started)
+      {
+         JMSBridgeImpl.log.warn("Attempt to stop, but is already stopped");
+         return;
+      }
 
       if (JMSBridgeImpl.trace)
       {
@@ -418,14 +411,6 @@
          {
             sourceReceiver.interrupt();
          }
-
-         executor.shutdown();
-         boolean ok = executor.awaitTermination(2 * failureRetryInterval, TimeUnit.MILLISECONDS);
-         
-         if (!ok)
-         {
-            log.warn("Timed out waiting to stop");
-         }
       }
 
       // This must be outside sync block
@@ -459,7 +444,7 @@
             JMSBridgeImpl.log.trace("Source receiver thread has finished");
          }
       }
-      
+
       if (tx != null)
       {
          // Terminate any transaction
@@ -1381,7 +1366,7 @@
 
       int count = 0;
 
-      while (true && !stopping)
+      while (true)
       {
          boolean ok = setupJMSObjects();
 
@@ -1637,7 +1622,9 @@
       // In the case of onMessage we can't close the connection from inside the onMessage method
       // since it will block waiting for onMessage to complete. In the case of start we want to return
       // from the call before the connections are reestablished so that the caller is not blocked unnecessarily.
-      executor.execute(new Thread(failureHandler, "jmsbridge-thread-pool"));
+      Thread t = new Thread(failureHandler, "jmsbridge-failurehandler-thread");
+
+      t.start();
    }
 
    private void addMessageIDInHeader(final Message msg) throws Exception

Modified: trunk/tests/src/org/hornetq/tests/integration/jms/bridge/JMSBridgeReconnectionTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/jms/bridge/JMSBridgeReconnectionTest.java	2010-04-15 13:41:16 UTC (rev 9124)
+++ trunk/tests/src/org/hornetq/tests/integration/jms/bridge/JMSBridgeReconnectionTest.java	2010-04-15 14:04:52 UTC (rev 9125)
@@ -145,7 +145,7 @@
    /**
     * https://jira.jboss.org/jira/browse/HORNETQ-287
     */
-   public void testStopBridgeWithFailureWhenStarted() throws Exception
+   public void _testStopBridgeWithFailureWhenStarted() throws Exception
    {
       jmsServer1.stop();
 



More information about the hornetq-commits mailing list