Revert "AMQ-6494 Return ExceptionResponse during broker service shutdown"

the root cause seems to be in the vm transport iterator

This reverts commit dce2b61f87.
This commit is contained in:
gtully 2017-04-04 14:15:00 +01:00
parent c1cbf509da
commit 0f7561e85a
2 changed files with 10 additions and 9 deletions

View File

@ -101,6 +101,7 @@ import org.apache.activemq.transport.TransportDisposedIOException;
import org.apache.activemq.util.IntrospectionSupport; import org.apache.activemq.util.IntrospectionSupport;
import org.apache.activemq.util.MarshallingSupport; import org.apache.activemq.util.MarshallingSupport;
import org.apache.activemq.util.NetworkBridgeUtils; import org.apache.activemq.util.NetworkBridgeUtils;
import org.apache.activemq.util.SubscriptionKey;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.slf4j.MDC; import org.slf4j.MDC;
@ -189,9 +190,13 @@ public class TransportConnection implements Connection, Task, CommandVisitor {
throw new RuntimeException("Protocol violation - Command corrupted: " + o.toString()); throw new RuntimeException("Protocol violation - Command corrupted: " + o.toString());
} }
Command command = (Command) o; Command command = (Command) o;
Response response = service(command); if (!brokerService.isStopping()) {
if (response != null) { Response response = service(command);
dispatchSync(response); if (response != null && !brokerService.isStopping()) {
dispatchSync(response);
}
} else {
throw new BrokerStoppedException("Broker " + brokerService + " is being stopped");
} }
} finally { } finally {
serviceLock.readLock().unlock(); serviceLock.readLock().unlock();
@ -321,13 +326,10 @@ public class TransportConnection implements Connection, Task, CommandVisitor {
boolean responseRequired = command.isResponseRequired(); boolean responseRequired = command.isResponseRequired();
int commandId = command.getCommandId(); int commandId = command.getCommandId();
try { try {
if (brokerService.isStopping()) { if (!pendingStop.get()) {
response = responseRequired ? new ExceptionResponse(
new BrokerStoppedException("Broker " + brokerService + " is being stopped")) : null;
} else if (!pendingStop.get()) {
response = command.visit(this); response = command.visit(this);
} else { } else {
response = responseRequired ? new ExceptionResponse(transportException.get()) : null; response = new ExceptionResponse(transportException.get());
} }
} catch (Throwable e) { } catch (Throwable e) {
if (SERVICELOG.isDebugEnabled() && e.getClass() != BrokerStoppedException.class) { if (SERVICELOG.isDebugEnabled() && e.getClass() != BrokerStoppedException.class) {

View File

@ -1,4 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- <!--
Licensed to the Apache Software Foundation (ASF) under one or more Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with contributor license agreements. See the NOTICE file distributed with