Jonas B. Lim 2006-09-14 07:19:17 +00:00
parent 125fbfed53
commit beb72f6403
3 changed files with 11 additions and 4 deletions

View File

@ -95,6 +95,7 @@ public abstract class AbstractConnection implements Service, Connection, Task, C
private WireFormatInfo wireFormatInfo;
protected boolean disposed=false;
protected IOException transportException;
static class ConnectionState extends org.apache.activemq.state.ConnectionState {
private final ConnectionContext context;
@ -175,6 +176,7 @@ public abstract class AbstractConnection implements Service, Connection, Task, C
public void serviceTransportException(IOException e) {
if( !disposed ) {
transportException = e;
if( transportLog.isDebugEnabled() )
transportLog.debug("Transport failed: "+e,e);
ServiceSupport.dispose(this);

View File

@ -22,13 +22,11 @@ import java.io.IOException;
import org.apache.activemq.broker.ft.MasterBroker;
import org.apache.activemq.command.BrokerInfo;
import org.apache.activemq.command.Command;
import org.apache.activemq.command.MessageDispatch;
import org.apache.activemq.command.Response;
import org.apache.activemq.command.ShutdownInfo;
import org.apache.activemq.thread.TaskRunnerFactory;
import org.apache.activemq.transport.DefaultTransportListener;
import org.apache.activemq.transport.Transport;
import org.apache.activemq.transport.TransportListener;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@ -85,7 +83,12 @@ public class TransportConnection extends AbstractConnection {
if (masterBroker != null){
masterBroker.stop();
}
transport.oneway(new ShutdownInfo());
// If the transport has not failed yet,
// notify the peer that we are doing a normal shutdown.
if( transportException == null ) {
transport.oneway(new ShutdownInfo());
}
} catch (Exception ignore) {
//ignore.printStackTrace();
}

View File

@ -281,7 +281,9 @@ public class TcpTransport extends TransportThreadSupport implements Transport, S
}
protected void doStop(ServiceStopper stopper) throws Exception {
closeStreams();
// Closing the streams flush the sockets before closing.. if the socket
// is hung.. then this hangs the close.
// closeStreams();
if (socket != null) {
socket.close();
}