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 8cf98a070f.

seems there are a bunch of network tests that don't conform with the new approach - back to the drawing board
This commit is contained in:
gtully 2015-02-12 16:01:09 +00:00
parent 7d14ddb0d1
commit b60bfbbeb4
5 changed files with 40 additions and 9 deletions

View File

@ -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();
}

View File

@ -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) {

View File

@ -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);

View File

@ -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();
}

View File

@ -262,6 +262,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 {