activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dej...@apache.org
Subject svn commit: r1079384 - in /activemq/trunk/activemq-core/src: main/java/org/apache/activemq/transport/failover/FailoverTransport.java test/java/org/apache/activemq/transport/failover/FailoverClusterTest.java
Date Tue, 08 Mar 2011 15:02:00 GMT
Author: dejanb
Date: Tue Mar  8 15:01:59 2011
New Revision: 1079384

URL: http://svn.apache.org/viewvc?rev=1079384&view=rev
Log:
https://issues.apache.org/jira/browse/AMQ-2632 - dispose the old transport listener before
rebalancing

Modified:
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/failover/FailoverTransport.java
    activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/failover/FailoverClusterTest.java

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/failover/FailoverTransport.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/failover/FailoverTransport.java?rev=1079384&r1=1079383&r2=1079384&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/failover/FailoverTransport.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/failover/FailoverTransport.java
Tue Mar  8 15:01:59 2011
@@ -205,6 +205,11 @@ public class FailoverTransport implement
         };
     }
 
+    public final void disposeTransport(Transport transport) {
+        transport.setTransportListener(disposedListener);
+        ServiceSupport.dispose(transport);
+    }
+
     public final void handleTransportFailure(IOException e) throws InterruptedException {
         if (LOG.isTraceEnabled()) {
             LOG.trace(this + " handleTransportFailure: " + e);
@@ -218,8 +223,7 @@ public class FailoverTransport implement
         }
         if (transport != null) {
 
-            transport.setTransportListener(disposedListener);
-            ServiceSupport.dispose(transport);
+            disposeTransport(transport);
 
             boolean reconnectOk = false;
             synchronized (reconnectMutex) {
@@ -808,7 +812,7 @@ public class FailoverTransport implement
                             try {
                                 Transport transport = this.connectedTransport.getAndSet(null);
                                 if (transport != null) {
-                                    transport.stop();
+                                    disposeTransport(transport);
                                 }
                             } catch (Exception e) {
                                 LOG.debug("Caught an exception stopping existing transport
for rebalance", e);

Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/failover/FailoverClusterTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/failover/FailoverClusterTest.java?rev=1079384&r1=1079383&r2=1079384&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/failover/FailoverClusterTest.java
(original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/failover/FailoverClusterTest.java
Tue Mar  8 15:01:59 2011
@@ -52,7 +52,7 @@ public class FailoverClusterTest extends
         if (brokerB == null) {
             brokerB = createBrokerB(BROKER_B_BIND_ADDRESS);
         }
-        Thread.sleep(5000);
+        Thread.sleep(3000);
         Set<String> set = new HashSet<String>();
         for (ActiveMQConnection c : connections) {
             set.add(c.getTransportChannel().getRemoteAddress());
@@ -66,7 +66,7 @@ public class FailoverClusterTest extends
             // add in server side only url param, should not be propagated
             brokerB = createBrokerB(BROKER_B_BIND_ADDRESS + "?transport.closeAsync=false");
         }
-        Thread.sleep(5000);
+        Thread.sleep(3000);
         Set<String> set = new HashSet<String>();
         for (ActiveMQConnection c : connections) {
             set.add(c.getTransportChannel().getRemoteAddress());



Mime
View raw message