Remove synchronized block around WebSocketSession.send
Since we now wrap the WebSocketSession with a concurrent decorator, the synchronized keyword around message sending needed to be removed. Issue: SPR-11586
This commit is contained in:
parent
796af90ba7
commit
299be08268
|
|
@ -118,6 +118,11 @@ public class ConcurrentWebSocketSessionDecorator extends WebSocketSessionDecorat
|
|||
}
|
||||
|
||||
private void checkSessionLimits() throws IOException {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Another send already in progress, session id '" + getId() + "'" +
|
||||
", in-progress send time " + getInProgressSendTime() + " (ms), " +
|
||||
", buffer size " + this.bufferSize + " bytes");
|
||||
}
|
||||
if (getInProgressSendTime() > this.sendTimeLimit) {
|
||||
logError("A message could not be sent due to a timeout");
|
||||
getDelegate().close();
|
||||
|
|
|
|||
|
|
@ -198,11 +198,9 @@ public class StompSubProtocolHandler implements SubProtocolHandler {
|
|||
try {
|
||||
message = MessageBuilder.withPayload(message.getPayload()).setHeaders(headers).build();
|
||||
byte[] bytes = this.stompEncoder.encode((Message<byte[]>) message);
|
||||
TextMessage textMessage = new TextMessage(bytes);
|
||||
|
||||
synchronized(session) {
|
||||
session.sendMessage(new TextMessage(bytes));
|
||||
}
|
||||
|
||||
session.sendMessage(textMessage);
|
||||
}
|
||||
catch (Throwable ex) {
|
||||
sendErrorMessage(session, ex);
|
||||
|
|
|
|||
|
|
@ -174,7 +174,7 @@ public class WebSocketServerSockJsSession extends AbstractSockJsSession implemen
|
|||
|
||||
@Override
|
||||
protected void disconnect(CloseStatus status) throws IOException {
|
||||
if (this.webSocketSession != null) {
|
||||
if (isActive()) {
|
||||
this.webSocketSession.close(status);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue