Skip to content

Commit 900dd0c

Browse files
committed
Polish contribution
See gh-35132
1 parent 41cb6ae commit 900dd0c

File tree

2 files changed

+15
-13
lines changed

2 files changed

+15
-13
lines changed

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

Lines changed: 13 additions & 12 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
@@ -91,7 +91,7 @@ public ConcurrentWebSocketSessionDecorator(WebSocketSession delegate, int sendTi
9191
* @param sendTimeLimit the send-time limit (milliseconds)
9292
* @param bufferSizeLimit the buffer-size limit (number of bytes)
9393
* @param overflowStrategy the overflow strategy to use; by default the
94-
* session is terminated.
94+
* session is terminated
9595
* @since 5.1
9696
*/
9797
public ConcurrentWebSocketSessionDecorator(
@@ -120,6 +120,14 @@ public int getBufferSizeLimit() {
120120
return this.bufferSizeLimit;
121121
}
122122

123+
/**
124+
* Return the configured {@link OverflowStrategy}.
125+
* @since 6.2.9
126+
*/
127+
public OverflowStrategy getOverflowStrategy() {
128+
return this.overflowStrategy;
129+
}
130+
123131
/**
124132
* Return the current buffer size (number of bytes).
125133
*/
@@ -276,13 +284,6 @@ public void close(CloseStatus status) throws IOException {
276284
}
277285
}
278286

279-
/**
280-
* Return the configured overflow strategy.
281-
* @since 6.3
282-
*/
283-
public OverflowStrategy getOverflowStrategy() {
284-
return this.overflowStrategy;
285-
}
286287

287288
@Override
288289
public String toString() {

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,8 @@ private void sendBlockingMessage(ConcurrentWebSocketSessionDecorator session) th
218218
@Test
219219
void configuredProperties() {
220220
TestWebSocketSession session = new TestWebSocketSession();
221-
ConcurrentWebSocketSessionDecorator sessionDecorator = new ConcurrentWebSocketSessionDecorator(session, 42, 43, OverflowStrategy.DROP);
221+
ConcurrentWebSocketSessionDecorator sessionDecorator =
222+
new ConcurrentWebSocketSessionDecorator(session, 42, 43, OverflowStrategy.DROP);
222223

223224
assertThat(sessionDecorator.getSendTimeLimit()).isEqualTo(42);
224225
assertThat(sessionDecorator.getBufferSizeLimit()).isEqualTo(43);

0 commit comments

Comments
 (0)