https://issues.apache.org/jira/browse/AMQ-2632 - dispose the old transport listener before rebalancing

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1079384 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Bosanac Dejan 2011-03-08 15:01:59 +00:00
parent 8fba621a08
commit 6c09e846b1
2 changed files with 9 additions and 5 deletions

View File

@ -205,6 +205,11 @@ public class FailoverTransport implements CompositeTransport {
};
}
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 implements CompositeTransport {
}
if (transport != null) {
transport.setTransportListener(disposedListener);
ServiceSupport.dispose(transport);
disposeTransport(transport);
boolean reconnectOk = false;
synchronized (reconnectMutex) {
@ -808,7 +812,7 @@ public class FailoverTransport implements CompositeTransport {
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);

View File

@ -52,7 +52,7 @@ public class FailoverClusterTest extends TestCase {
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 TestCase {
// 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());