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:
Rossen Stoyanchev
2014-06-28 14:33:00 -04:00
parent 86de416908
commit 3af488a701

View File

@@ -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);
}