mirror of https://github.com/apache/activemq.git
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.
This commit is contained in:
parent
de5d0d9430
commit
bbde8473bd
|
@ -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");
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue