Skip to content

Commit 60b1927

Browse files
committed
Merge branch '6.2.x'
2 parents 1a9f19f + 900dd0c commit 60b1927

File tree

2 files changed

+24
-5
lines changed

2 files changed

+24
-5
lines changed

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

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@
3636
* Wrap a {@link org.springframework.web.socket.WebSocketSession WebSocketSession}
3737
* to guarantee only one thread can send messages at a time.
3838
*
39-
* <p>If a send is slow, subsequent attempts to send more messages from other threads
40-
* will not be able to acquire the flush lock and messages will be buffered instead.
41-
* At that time, the specified buffer-size limit and send-time limit will be checked
42-
* and the session will be closed if the limits are exceeded.
39+
* <p>If a {@code send} is slow, subsequent attempts to send more messages from
40+
* other threads will not be able to acquire the flush lock, and messages will be
41+
* buffered instead. At that time, the specified buffer-size limit and send-time
42+
* limit will be checked, and the session will be closed if the limits are exceeded.
4343
*
4444
* @author Rossen Stoyanchev
4545
* @author Juergen Hoeller
@@ -90,7 +90,7 @@ public ConcurrentWebSocketSessionDecorator(WebSocketSession delegate, int sendTi
9090
* @param sendTimeLimit the send-time limit (milliseconds)
9191
* @param bufferSizeLimit the buffer-size limit (number of bytes)
9292
* @param overflowStrategy the overflow strategy to use; by default the
93-
* session is terminated.
93+
* session is terminated
9494
* @since 5.1
9595
*/
9696
public ConcurrentWebSocketSessionDecorator(
@@ -119,6 +119,14 @@ public int getBufferSizeLimit() {
119119
return this.bufferSizeLimit;
120120
}
121121

122+
/**
123+
* Return the configured {@link OverflowStrategy}.
124+
* @since 6.2.9
125+
*/
126+
public OverflowStrategy getOverflowStrategy() {
127+
return this.overflowStrategy;
128+
}
129+
122130
/**
123131
* Return the current buffer size (number of bytes).
124132
*/

spring-websocket/src/test/java/org/springframework/web/socket/handler/ConcurrentWebSocketSessionDecoratorTests.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,4 +215,15 @@ private void sendBlockingMessage(ConcurrentWebSocketSessionDecorator session) th
215215
assertThat(latch.await(5, TimeUnit.SECONDS)).isTrue();
216216
}
217217

218+
@Test
219+
void configuredProperties() {
220+
TestWebSocketSession session = new TestWebSocketSession();
221+
ConcurrentWebSocketSessionDecorator sessionDecorator =
222+
new ConcurrentWebSocketSessionDecorator(session, 42, 43, OverflowStrategy.DROP);
223+
224+
assertThat(sessionDecorator.getSendTimeLimit()).isEqualTo(42);
225+
assertThat(sessionDecorator.getBufferSizeLimit()).isEqualTo(43);
226+
assertThat(sessionDecorator.getOverflowStrategy()).isEqualTo(OverflowStrategy.DROP);
227+
}
228+
218229
}

0 commit comments

Comments
 (0)