Browse Source

Synchronize request init in AbstractHttpSockJsSession

Although unlikely in practice (but not impossible), the SockJS
integration tests write a message while the request is initializing.
This change adds synchronization around request intiailization
for the SockJS HTTP sesion.

This is a backport of:
59e02e63c4

Issue: SPR-11916
pull/618/head
Rossen Stoyanchev 12 years ago
parent
commit
977c5ca439
  1. 2
      spring-websocket/src/main/java/org/springframework/web/socket/sockjs/transport/session/AbstractHttpSockJsSession.java

2
spring-websocket/src/main/java/org/springframework/web/socket/sockjs/transport/session/AbstractHttpSockJsSession.java

@ -201,6 +201,7 @@ public abstract class AbstractHttpSockJsSession extends AbstractSockJsSession {
this.frameFormat = frameFormat; this.frameFormat = frameFormat;
this.asyncRequestControl = request.getAsyncRequestControl(response); this.asyncRequestControl = request.getAsyncRequestControl(response);
synchronized (this.responseLock) {
try { try {
// Let "our" handler know before sending the open frame to the remote handler // Let "our" handler know before sending the open frame to the remote handler
delegateConnectionEstablished(); delegateConnectionEstablished();
@ -215,6 +216,7 @@ public abstract class AbstractHttpSockJsSession extends AbstractSockJsSession {
throw new SockJsTransportFailureException("Failed to open session", getId(), ex); throw new SockJsTransportFailureException("Failed to open session", getId(), ex);
} }
} }
}
protected void writePrelude(ServerHttpRequest request, ServerHttpResponse response) throws IOException { protected void writePrelude(ServerHttpRequest request, ServerHttpResponse response) throws IOException {
} }

Loading…
Cancel
Save