activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dej...@apache.org
Subject svn commit: r1395976 - in /activemq/trunk: activemq-core/src/main/java/org/apache/activemq/transport/stomp/ProtocolConverter.java activemq-optional/src/main/java/org/apache/activemq/transport/ws/StompSocket.java
Date Tue, 09 Oct 2012 11:40:40 GMT
Author: dejanb
Date: Tue Oct  9 11:40:39 2012
New Revision: 1395976

URL: http://svn.apache.org/viewvc?rev=1395976&view=rev
Log:
https://issues.apache.org/jira/browse/AMQ-4100 - clean on websocket close

Modified:
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/ProtocolConverter.java
    activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/ws/StompSocket.java

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/ProtocolConverter.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/ProtocolConverter.java?rev=1395976&r1=1395975&r2=1395976&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/ProtocolConverter.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/ProtocolConverter.java
Tue Oct  9 11:40:39 2012
@@ -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 {

Modified: activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/ws/StompSocket.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/ws/StompSocket.java?rev=1395976&r1=1395975&r2=1395976&view=diff
==============================================================================
--- activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/ws/StompSocket.java
(original)
+++ activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/ws/StompSocket.java
Tue Oct  9 11:40:39 2012
@@ -21,8 +21,10 @@ import java.security.cert.X509Certificat
 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 TransportSuppo
 
     @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



Mime
View raw message