You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by gt...@apache.org on 2015/02/12 19:00:37 UTC

activemq git commit: Revert "rework https://issues.apache.org/jira/browse/AMQ-3684 and https://issues.apache.org/jira/browse/AMQ-4532 to avoid intermittent hangs, processing shutdown wile shutdown is in progress - AMQ1936Test and AMQ2021Test - using jus

Repository: activemq
Updated Branches:
  refs/heads/master 7d14ddb0d -> b60bfbbeb


Revert "rework  https://issues.apache.org/jira/browse/AMQ-3684 and https://issues.apache.org/jira/browse/AMQ-4532 to avoid intermittent hangs, processing shutdown wile shutdown is in progress - AMQ1936Test and AMQ2021Test - using just TransportDisposedIOException to propagate exception response and start shutdown process and ignoring broker side for logging"

This reverts commit 8cf98a070f0fb60857e85cb74c4969d0256ebb0e.

seems there are a bunch of network tests that don't conform with the new approach - back to the drawing board


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

Branch: refs/heads/master
Commit: b60bfbbeb4cc25e38c6c82e0d94e22e31fe96da3
Parents: 7d14ddb
Author: gtully <ga...@gmail.com>
Authored: Thu Feb 12 16:01:09 2015 +0000
Committer: gtully <ga...@gmail.com>
Committed: Thu Feb 12 18:00:58 2015 +0000

----------------------------------------------------------------------
 .../activemq/broker/TransportConnection.java    | 10 ++++----
 .../activemq/transport/vm/VMTransport.java      | 10 +++++++-
 .../java/org/apache/activemq/TestSupport.java   |  2 +-
 .../org/apache/activemq/bugs/AMQ2902Test.java   |  2 +-
 .../transport/vm/VMTransportThreadSafeTest.java | 25 ++++++++++++++++++++
 5 files changed, 40 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq/blob/b60bfbbe/activemq-broker/src/main/java/org/apache/activemq/broker/TransportConnection.java
----------------------------------------------------------------------
diff --git a/activemq-broker/src/main/java/org/apache/activemq/broker/TransportConnection.java b/activemq-broker/src/main/java/org/apache/activemq/broker/TransportConnection.java
index 5da0cfa..270ed9f 100755
--- a/activemq-broker/src/main/java/org/apache/activemq/broker/TransportConnection.java
+++ b/activemq-broker/src/main/java/org/apache/activemq/broker/TransportConnection.java
@@ -239,12 +239,10 @@ public class TransportConnection implements Connection, Task, CommandVisitor {
         }
         if (!stopping.get() && !pendingStop) {
             transportException.set(e);
-            if (! (e instanceof TransportDisposedIOException)) {
-                if (TRANSPORTLOG.isDebugEnabled()) {
-                    TRANSPORTLOG.debug(this + " failed: " + e, e);
-                } else if (TRANSPORTLOG.isWarnEnabled() && !expected(e)) {
-                    TRANSPORTLOG.warn(this + " failed: " + e);
-                }
+            if (TRANSPORTLOG.isDebugEnabled()) {
+                TRANSPORTLOG.debug(this + " failed: " + e, e);
+            } else if (TRANSPORTLOG.isWarnEnabled() && !expected(e)) {
+                TRANSPORTLOG.warn(this + " failed: " + e);
             }
             stopAsync();
         }

http://git-wip-us.apache.org/repos/asf/activemq/blob/b60bfbbe/activemq-broker/src/main/java/org/apache/activemq/transport/vm/VMTransport.java
----------------------------------------------------------------------
diff --git a/activemq-broker/src/main/java/org/apache/activemq/transport/vm/VMTransport.java b/activemq-broker/src/main/java/org/apache/activemq/transport/vm/VMTransport.java
index 7b4e1a9..75bd6fe 100755
--- a/activemq-broker/src/main/java/org/apache/activemq/transport/vm/VMTransport.java
+++ b/activemq-broker/src/main/java/org/apache/activemq/transport/vm/VMTransport.java
@@ -194,7 +194,15 @@ public class VMTransport implements Transport, Task {
             }
 
             if (peer.transportListener != null) {
-                // let any requests pending a response see an exception and shutdown
+                // let the peer know that we are disconnecting after attempting
+                // to cleanly shutdown the async tasks so that this is the last
+                // command it see's.
+                try {
+                    peer.transportListener.onCommand(new ShutdownInfo());
+                } catch (Exception ignore) {
+                }
+
+                // let any requests pending a response see an exception
                 try {
                     peer.transportListener.onException(new TransportDisposedIOException("peer (" + this + ") stopped."));
                 } catch (Exception ignore) {

http://git-wip-us.apache.org/repos/asf/activemq/blob/b60bfbbe/activemq-unit-tests/src/test/java/org/apache/activemq/TestSupport.java
----------------------------------------------------------------------
diff --git a/activemq-unit-tests/src/test/java/org/apache/activemq/TestSupport.java b/activemq-unit-tests/src/test/java/org/apache/activemq/TestSupport.java
index 90c1bd2..a762f89 100755
--- a/activemq-unit-tests/src/test/java/org/apache/activemq/TestSupport.java
+++ b/activemq-unit-tests/src/test/java/org/apache/activemq/TestSupport.java
@@ -173,7 +173,7 @@ public abstract class TestSupport extends CombinationTestSupport {
                         regionBroker.getTopicRegion().getDestinationMap();
     }
 
-    public static enum PersistenceAdapterChoice {LevelDB, KahaDB, JDBC, MEM };
+    public static enum PersistenceAdapterChoice {LevelDB, KahaDB, AMQ, JDBC, MEM };
 
     public PersistenceAdapter setDefaultPersistenceAdapter(BrokerService broker) throws IOException {
         return setPersistenceAdapter(broker, defaultPersistenceAdapter);

http://git-wip-us.apache.org/repos/asf/activemq/blob/b60bfbbe/activemq-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ2902Test.java
----------------------------------------------------------------------
diff --git a/activemq-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ2902Test.java b/activemq-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ2902Test.java
index 39e0407..3c38186 100644
--- a/activemq-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ2902Test.java
+++ b/activemq-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ2902Test.java
@@ -75,7 +75,7 @@ public class AMQ2902Test extends TestCase {
 
     public void testNoExceptionOnClose() throws JMSException {
         ConnectionFactory connectionFactory = new ActiveMQConnectionFactory(
-                "vm://localhostTwo?broker.persistent=false");
+                "vm://localhost?broker.persistent=false");
         Connection connection = connectionFactory.createConnection();
         connection.close();
     }

http://git-wip-us.apache.org/repos/asf/activemq/blob/b60bfbbe/activemq-unit-tests/src/test/java/org/apache/activemq/transport/vm/VMTransportThreadSafeTest.java
----------------------------------------------------------------------
diff --git a/activemq-unit-tests/src/test/java/org/apache/activemq/transport/vm/VMTransportThreadSafeTest.java b/activemq-unit-tests/src/test/java/org/apache/activemq/transport/vm/VMTransportThreadSafeTest.java
index ea3d833..8534f89 100644
--- a/activemq-unit-tests/src/test/java/org/apache/activemq/transport/vm/VMTransportThreadSafeTest.java
+++ b/activemq-unit-tests/src/test/java/org/apache/activemq/transport/vm/VMTransportThreadSafeTest.java
@@ -263,6 +263,31 @@ public class VMTransportThreadSafeTest {
     }
 
     @Test(timeout=60000)
+    public void testStopSendsShutdownToPeer() throws Exception {
+
+        final VMTransport local = new VMTransport(new URI(location1));
+        final VMTransport remote = new VMTransport(new URI(location2));
+
+        local.setPeer(remote);
+        remote.setPeer(local);
+
+        final VMTestTransportListener remoteListener = new VMTestTransportListener(remoteReceived);
+
+        local.setTransportListener(new VMTestTransportListener(localReceived));
+        remote.setTransportListener(remoteListener);
+
+        local.start();
+        local.stop();
+
+        assertTrue(Wait.waitFor(new Wait.Condition() {
+            @Override
+            public boolean isSatisified() throws Exception {
+                return remoteListener.shutdownReceived;
+            }
+        }));
+    }
+
+    @Test(timeout=60000)
     public void testRemoteStopSendsExceptionToPendingRequests() throws Exception {
 
         final VMTransport local = new VMTransport(new URI(location1));