diff --git a/spring-websocket/src/main/java/org/springframework/web/socket/handler/ConcurrentWebSocketSessionDecorator.java b/spring-websocket/src/main/java/org/springframework/web/socket/handler/ConcurrentWebSocketSessionDecorator.java index c5fe7f8526..0113f89b0b 100644 --- a/spring-websocket/src/main/java/org/springframework/web/socket/handler/ConcurrentWebSocketSessionDecorator.java +++ b/spring-websocket/src/main/java/org/springframework/web/socket/handler/ConcurrentWebSocketSessionDecorator.java @@ -36,10 +36,10 @@ import org.springframework.web.socket.WebSocketSession; * Wrap a {@link org.springframework.web.socket.WebSocketSession WebSocketSession} * to guarantee only one thread can send messages at a time. * - *
If a send is slow, subsequent attempts to send more messages from other threads - * will not be able to acquire the flush lock and messages will be buffered instead. - * At that time, the specified buffer-size limit and send-time limit will be checked - * and the session will be closed if the limits are exceeded. + *
If a {@code send} is slow, subsequent attempts to send more messages from + * other threads will not be able to acquire the flush lock, and messages will be + * buffered instead. At that time, the specified buffer-size limit and send-time + * limit will be checked, and the session will be closed if the limits are exceeded. * * @author Rossen Stoyanchev * @author Juergen Hoeller @@ -90,7 +90,7 @@ public class ConcurrentWebSocketSessionDecorator extends WebSocketSessionDecorat * @param sendTimeLimit the send-time limit (milliseconds) * @param bufferSizeLimit the buffer-size limit (number of bytes) * @param overflowStrategy the overflow strategy to use; by default the - * session is terminated. + * session is terminated * @since 5.1 */ public ConcurrentWebSocketSessionDecorator( @@ -119,6 +119,14 @@ public class ConcurrentWebSocketSessionDecorator extends WebSocketSessionDecorat return this.bufferSizeLimit; } + /** + * Return the configured {@link OverflowStrategy}. + * @since 6.2.9 + */ + public OverflowStrategy getOverflowStrategy() { + return this.overflowStrategy; + } + /** * Return the current buffer size (number of bytes). */ diff --git a/spring-websocket/src/test/java/org/springframework/web/socket/handler/ConcurrentWebSocketSessionDecoratorTests.java b/spring-websocket/src/test/java/org/springframework/web/socket/handler/ConcurrentWebSocketSessionDecoratorTests.java index 8f8b595e81..85678fce77 100644 --- a/spring-websocket/src/test/java/org/springframework/web/socket/handler/ConcurrentWebSocketSessionDecoratorTests.java +++ b/spring-websocket/src/test/java/org/springframework/web/socket/handler/ConcurrentWebSocketSessionDecoratorTests.java @@ -215,4 +215,15 @@ class ConcurrentWebSocketSessionDecoratorTests { assertThat(latch.await(5, TimeUnit.SECONDS)).isTrue(); } + @Test + void configuredProperties() { + TestWebSocketSession session = new TestWebSocketSession(); + ConcurrentWebSocketSessionDecorator sessionDecorator = + new ConcurrentWebSocketSessionDecorator(session, 42, 43, OverflowStrategy.DROP); + + assertThat(sessionDecorator.getSendTimeLimit()).isEqualTo(42); + assertThat(sessionDecorator.getBufferSizeLimit()).isEqualTo(43); + assertThat(sessionDecorator.getOverflowStrategy()).isEqualTo(OverflowStrategy.DROP); + } + }