git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1395976 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Bosanac Dejan 2012-10-09 11:40:39 +00:00
parent 07ade0db8f
commit cc95295139
2 changed files with 12 additions and 4 deletions

View File

@ -737,11 +737,12 @@ public class ProtocolConverter {
}
protected void onStompDisconnect(StompFrame command) throws ProtocolException {
checkConnected();
if (connected.get()) {
sendToActiveMQ(connectionInfo.createRemoveCommand(), createResponseHandler(command));
sendToActiveMQ(new ShutdownInfo(), createResponseHandler(command));
connected.set(false);
}
}
protected void checkConnected() throws ProtocolException {
if (!connected.get()) {

View File

@ -21,8 +21,10 @@ import java.security.cert.X509Certificate;
import java.util.concurrent.CountDownLatch;
import org.apache.activemq.command.Command;
import org.apache.activemq.command.ShutdownInfo;
import org.apache.activemq.transport.TransportSupport;
import org.apache.activemq.transport.stomp.ProtocolConverter;
import org.apache.activemq.transport.stomp.Stomp;
import org.apache.activemq.transport.stomp.StompFrame;
import org.apache.activemq.transport.stomp.StompInactivityMonitor;
import org.apache.activemq.transport.stomp.StompTransport;
@ -52,6 +54,11 @@ class StompSocket extends TransportSupport implements WebSocket.OnTextMessage, S
@Override
public void onClose(int closeCode, String message) {
try {
protocolConverter.onStompCommand(new StompFrame(Stomp.Commands.DISCONNECT));
} catch (Exception e) {
LOG.warn("Failed to close WebSocket", e);
}
}
@Override