Polish contribution
Backport Bot / build (push) Waiting to run Details
Build and Deploy Snapshot / Build and Deploy Snapshot (push) Waiting to run Details
Build and Deploy Snapshot / Verify (push) Blocked by required conditions Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:false version:17], map[id:ubuntu-latest name:Linux]) (push) Waiting to run Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:true version:21], map[id:ubuntu-latest name:Linux]) (push) Waiting to run Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:true version:23], map[id:ubuntu-latest name:Linux]) (push) Waiting to run Details
Deploy Docs / Dispatch docs deployment (push) Waiting to run Details

See gh-35132
This commit is contained in:
Sam Brannen 2025-06-30 17:29:36 +02:00
parent 41cb6ae1a5
commit 900dd0c3eb
2 changed files with 15 additions and 13 deletions

View File

@ -36,10 +36,10 @@ import org.springframework.web.socket.WebSocketSession;
* Wrap a {@link org.springframework.web.socket.WebSocketSession WebSocketSession} * Wrap a {@link org.springframework.web.socket.WebSocketSession WebSocketSession}
* to guarantee only one thread can send messages at a time. * to guarantee only one thread can send messages at a time.
* *
* <p>If a send is slow, subsequent attempts to send more messages from other threads * <p>If a {@code send} is slow, subsequent attempts to send more messages from
* will not be able to acquire the flush lock and messages will be buffered instead. * other threads will not be able to acquire the flush lock, and messages will be
* At that time, the specified buffer-size limit and send-time limit will be checked * buffered instead. At that time, the specified buffer-size limit and send-time
* and the session will be closed if the limits are exceeded. * limit will be checked, and the session will be closed if the limits are exceeded.
* *
* @author Rossen Stoyanchev * @author Rossen Stoyanchev
* @author Juergen Hoeller * @author Juergen Hoeller
@ -91,7 +91,7 @@ public class ConcurrentWebSocketSessionDecorator extends WebSocketSessionDecorat
* @param sendTimeLimit the send-time limit (milliseconds) * @param sendTimeLimit the send-time limit (milliseconds)
* @param bufferSizeLimit the buffer-size limit (number of bytes) * @param bufferSizeLimit the buffer-size limit (number of bytes)
* @param overflowStrategy the overflow strategy to use; by default the * @param overflowStrategy the overflow strategy to use; by default the
* session is terminated. * session is terminated
* @since 5.1 * @since 5.1
*/ */
public ConcurrentWebSocketSessionDecorator( public ConcurrentWebSocketSessionDecorator(
@ -120,6 +120,14 @@ public class ConcurrentWebSocketSessionDecorator extends WebSocketSessionDecorat
return this.bufferSizeLimit; 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). * Return the current buffer size (number of bytes).
*/ */
@ -276,13 +284,6 @@ public class ConcurrentWebSocketSessionDecorator extends WebSocketSessionDecorat
} }
} }
/**
* Return the configured overflow strategy.
* @since 6.3
*/
public OverflowStrategy getOverflowStrategy() {
return this.overflowStrategy;
}
@Override @Override
public String toString() { public String toString() {

View File

@ -218,7 +218,8 @@ class ConcurrentWebSocketSessionDecoratorTests {
@Test @Test
void configuredProperties() { void configuredProperties() {
TestWebSocketSession session = new TestWebSocketSession(); TestWebSocketSession session = new TestWebSocketSession();
ConcurrentWebSocketSessionDecorator sessionDecorator = new ConcurrentWebSocketSessionDecorator(session, 42, 43, OverflowStrategy.DROP); ConcurrentWebSocketSessionDecorator sessionDecorator =
new ConcurrentWebSocketSessionDecorator(session, 42, 43, OverflowStrategy.DROP);
assertThat(sessionDecorator.getSendTimeLimit()).isEqualTo(42); assertThat(sessionDecorator.getSendTimeLimit()).isEqualTo(42);
assertThat(sessionDecorator.getBufferSizeLimit()).isEqualTo(43); assertThat(sessionDecorator.getBufferSizeLimit()).isEqualTo(43);