From bbde8473bd12a7ce5f34977eddfc3fcce3bde7c2 Mon Sep 17 00:00:00 2001 From: "Christopher L. Shannon (cshannon)" Date: Sun, 22 Nov 2015 19:01:31 +0000 Subject: [PATCH] https://issues.apache.org/jira/browse/AMQ-5980 Fixing an intermittent test failure in: org.apache.activemq.transport.ws.StompWSSTransportTest. testHeartbeatsKeepsConnectionOpen Adding synchronization on sends for StompWSConnection. The protocol doesn't allow multiple threads to call a blocking send at the same time and the heartbeat keep alive thread was colliding with the main thread on sends. --- .../org/apache/activemq/transport/ws/StompWSConnection.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/activemq-http/src/main/java/org/apache/activemq/transport/ws/StompWSConnection.java b/activemq-http/src/main/java/org/apache/activemq/transport/ws/StompWSConnection.java index 8531c73ac1..af7f86058a 100644 --- a/activemq-http/src/main/java/org/apache/activemq/transport/ws/StompWSConnection.java +++ b/activemq-http/src/main/java/org/apache/activemq/transport/ws/StompWSConnection.java @@ -57,17 +57,17 @@ public class StompWSConnection extends WebSocketAdapter implements WebSocketList //---- Send methods ------------------------------------------------------// - public void sendRawFrame(String rawFrame) throws Exception { + public synchronized void sendRawFrame(String rawFrame) throws Exception { checkConnected(); connection.getRemote().sendString(rawFrame); } - public void sendFrame(StompFrame frame) throws Exception { + public synchronized void sendFrame(StompFrame frame) throws Exception { checkConnected(); connection.getRemote().sendString(frame.format()); } - public void keepAlive() throws Exception { + public synchronized void keepAlive() throws Exception { checkConnected(); connection.getRemote().sendString("\n"); }