Avoid multiple invocations of afterConnectionClosed
This change ensures the state of a SockJS session is set to CLOSED immediately after close is invoked. This avoids duplicate invocations of afterConnectionClosed in WebSocket transport. Issue: SPR-11884
This commit is contained in:
@@ -271,6 +271,7 @@ public abstract class AbstractSockJsSession implements SockJsSession {
|
||||
if (logger.isInfoEnabled()) {
|
||||
logger.info("Closing SockJS session " + getId() + " with " + status);
|
||||
}
|
||||
this.state = State.CLOSED;
|
||||
try {
|
||||
if (isActive() && !CloseStatus.SESSION_NOT_RELIABLE.equals(status)) {
|
||||
try {
|
||||
@@ -285,7 +286,6 @@ public abstract class AbstractSockJsSession implements SockJsSession {
|
||||
disconnect(status);
|
||||
}
|
||||
finally {
|
||||
this.state = State.CLOSED;
|
||||
try {
|
||||
this.handler.afterConnectionClosed(this, status);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user