mirror of https://github.com/apache/activemq.git
https://issues.apache.org/jira/browse/AMQ-4100 - clean on websocket close
git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1395976 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
07ade0db8f
commit
cc95295139
|
@ -737,10 +737,11 @@ public class ProtocolConverter {
|
|||
}
|
||||
|
||||
protected void onStompDisconnect(StompFrame command) throws ProtocolException {
|
||||
checkConnected();
|
||||
sendToActiveMQ(connectionInfo.createRemoveCommand(), createResponseHandler(command));
|
||||
sendToActiveMQ(new ShutdownInfo(), createResponseHandler(command));
|
||||
connected.set(false);
|
||||
if (connected.get()) {
|
||||
sendToActiveMQ(connectionInfo.createRemoveCommand(), createResponseHandler(command));
|
||||
sendToActiveMQ(new ShutdownInfo(), createResponseHandler(command));
|
||||
connected.set(false);
|
||||
}
|
||||
}
|
||||
|
||||
protected void checkConnected() throws ProtocolException {
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue