Browse Source

Skip close lock if acquired by other thread already

Closes gh-32445

(cherry picked from commit d151931f86)
pull/32754/head
Juergen Hoeller 2 years ago
parent
commit
6b6beec4ee
  1. 5
      spring-websocket/src/main/java/org/springframework/web/socket/handler/ConcurrentWebSocketSessionDecorator.java

5
spring-websocket/src/main/java/org/springframework/web/socket/handler/ConcurrentWebSocketSessionDecorator.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -248,7 +248,7 @@ public class ConcurrentWebSocketSessionDecorator extends WebSocketSessionDecorat @@ -248,7 +248,7 @@ public class ConcurrentWebSocketSessionDecorator extends WebSocketSessionDecorat
@Override
public void close(CloseStatus status) throws IOException {
this.closeLock.lock();
if (this.closeLock.tryLock()) {
try {
if (this.closeInProgress) {
return;
@ -274,6 +274,7 @@ public class ConcurrentWebSocketSessionDecorator extends WebSocketSessionDecorat @@ -274,6 +274,7 @@ public class ConcurrentWebSocketSessionDecorator extends WebSocketSessionDecorat
this.closeLock.unlock();
}
}
}
@Override

Loading…
Cancel
Save