Repository: activemq Updated Branches: refs/heads/master de5d0d943 -> bbde8473b
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. Project: http://git-wip-us.apache.org/repos/asf/activemq/repo Commit: http://git-wip-us.apache.org/repos/asf/activemq/commit/bbde8473 Tree: http://git-wip-us.apache.org/repos/asf/activemq/tree/bbde8473 Diff: http://git-wip-us.apache.org/repos/asf/activemq/diff/bbde8473 Branch: refs/heads/master Commit: bbde8473bd12a7ce5f34977eddfc3fcce3bde7c2 Parents: de5d0d9 Author: Christopher L. Shannon (cshannon) <christopher.l.shan...@gmail.com> Authored: Sun Nov 22 19:01:31 2015 +0000 Committer: Christopher L. Shannon (cshannon) <christopher.l.shan...@gmail.com> Committed: Sun Nov 22 19:01:31 2015 +0000 ---------------------------------------------------------------------- .../org/apache/activemq/transport/ws/StompWSConnection.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/activemq/blob/bbde8473/activemq-http/src/main/java/org/apache/activemq/transport/ws/StompWSConnection.java ---------------------------------------------------------------------- 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 8531c73..af7f860 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"); }