-
Notifications
You must be signed in to change notification settings - Fork 1.1k
GH-8678: Make Buffer Overflow Strategy Configurable in IntegrationWebSocketContainer #8679
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
… IntegrationWebSocketContainer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the contribution.
A couple more comments to whatever I have already reviewed:
- Any chances to have a simple unit test to new property is propagated properly to the decorated
WebSocketSession
. We can verify that viaTestWebSocketListener
in theClientWebSocketContainerTests
. - Add your name to the
@author
list of the affected classes.
@@ -67,6 +68,9 @@ public abstract class IntegrationWebSocketContainer implements DisposableBean { | |||
|
|||
public static final int DEFAULT_SEND_BUFFER_SIZE = 512 * 1024; | |||
|
|||
public static final ConcurrentWebSocketSessionDecorator.OverflowStrategy DEFAULT_SEND_BUFFER_OVERFLOW_STRATEGY = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need this extra property for a default value: we simply can initialize our sendBufferOverflowStrategy
with that ConcurrentWebSocketSessionDecorator.OverflowStrategy.TERMINATE
as default value.
Or better to have this as null
and chose an appropriate ctor when we instantiate ConcurrentWebSocketSessionDecorator
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I considered the latter approach as well. I thought that having the default be explicit in this class, in addition to ConcurrentWebSocketSessionDecorator
, would relieve users of having to open up ConcurrentWebSocketSessionDecorator
to see the default.
We could mention that TERMINATE
is the default in the Javadoc, but I feel like that would more than likely not get updated if the default is ever changed in ConcurrentWebSocketSessionDecorator
. Thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, to have a single place of truth, I'd prefer a @see ConcurrentWebSocketSessionDecorator
in our new setter for this strategy.
Right, user would need to look there for more info, but then we would not not to worry about breaking change ever.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair enough, I'll get that implemented :)
* By default, the session associated with the culpable message is terminated. | ||
* | ||
* @param overflowStrategy The overflow strategy to use (see {@link ConcurrentWebSocketSessionDecorator.OverflowStrategy}). | ||
* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Our preferences do not have blank lines in method Javadocs: https://github.com/spring-projects/spring-framework/wiki/Code-Style#javadoc-formatting
Thank you for the detailed review & comments! About the unit test: Unlike In the meantime, the only way I can see to implement this test is by testing the actual behavior (I'm assuming using reflection to get the field value is out of the question). That would essentially duplicate this test case of Spring WebSocket. |
No, we should not. See the mentioned |
Right, I just wasn't aware that extracting private values like that was common practice. Won't be an issue then, thanks for the heads up. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm merging with with some refactoring to be able to back-port this down to 5.5.x
where we cannot use record
yet.
Merged as be53593. |
Implement #8678: Make the send buffer overflow strategy configurable in IntegrationWebSocketContainer.
Adds a simple setter that is the missing analogue to
setSendTimeLimit
andsetSendBufferSizeLimit
.