mirror of https://github.com/apache/activemq.git
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 commit is contained in:
parent
c6837acefe
commit
8cf98a070f
|
@ -239,10 +239,12 @@ public class TransportConnection implements Connection, Task, CommandVisitor {
|
|||
}
|
||||
if (!stopping.get() && !pendingStop) {
|
||||
transportException.set(e);
|
||||
if (TRANSPORTLOG.isDebugEnabled()) {
|
||||
TRANSPORTLOG.debug(this + " failed: " + e, e);
|
||||
} else if (TRANSPORTLOG.isWarnEnabled() && !expected(e)) {
|
||||
TRANSPORTLOG.warn(this + " failed: " + 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);
|
||||
}
|
||||
}
|
||||
stopAsync();
|
||||
}
|
||||
|
|
|
@ -194,15 +194,7 @@ public class VMTransport implements Transport, Task {
|
|||
}
|
||||
|
||||
if (peer.transportListener != null) {
|
||||
// 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
|
||||
// let any requests pending a response see an exception and shutdown
|
||||
try {
|
||||
peer.transportListener.onException(new TransportDisposedIOException("peer (" + this + ") stopped."));
|
||||
} catch (Exception ignore) {
|
||||
|
|
|
@ -173,7 +173,7 @@ public abstract class TestSupport extends CombinationTestSupport {
|
|||
regionBroker.getTopicRegion().getDestinationMap();
|
||||
}
|
||||
|
||||
public static enum PersistenceAdapterChoice {LevelDB, KahaDB, AMQ, JDBC, MEM };
|
||||
public static enum PersistenceAdapterChoice {LevelDB, KahaDB, JDBC, MEM };
|
||||
|
||||
public PersistenceAdapter setDefaultPersistenceAdapter(BrokerService broker) throws IOException {
|
||||
return setPersistenceAdapter(broker, defaultPersistenceAdapter);
|
||||
|
|
|
@ -75,7 +75,7 @@ public class AMQ2902Test extends TestCase {
|
|||
|
||||
public void testNoExceptionOnClose() throws JMSException {
|
||||
ConnectionFactory connectionFactory = new ActiveMQConnectionFactory(
|
||||
"vm://localhost?broker.persistent=false");
|
||||
"vm://localhostTwo?broker.persistent=false");
|
||||
Connection connection = connectionFactory.createConnection();
|
||||
connection.close();
|
||||
}
|
||||
|
|
|
@ -262,31 +262,6 @@ 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 {
|
||||
|
||||
|
|
Loading…
Reference in New Issue