-
Notifications
You must be signed in to change notification settings - Fork 1.1k
GH-10314: Revise TcpListener.onMessage() contract for void
#10315
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -194,16 +194,14 @@ public boolean isServer() { | |
| } | ||
|
|
||
| @Override | ||
| public boolean onMessage(Message<?> message) { | ||
| public void onMessage(Message<?> message) { | ||
| if (this.tcpListener == null) { | ||
| if (message instanceof ErrorMessage) { | ||
| return false; | ||
| } | ||
| else { | ||
| if (!(message instanceof ErrorMessage)) { | ||
| throw new NoListenerException("No listener registered for message reception"); | ||
| } | ||
| return; | ||
| } | ||
| return this.tcpListener.onMessage(message); | ||
| this.tcpListener.onMessage(message); | ||
| } | ||
|
|
||
| @Override | ||
|
|
@@ -250,12 +248,16 @@ public void removeDeadConnection(TcpConnection connection) { | |
| return; | ||
| } | ||
| this.removed = true; | ||
| if (this.theConnection instanceof TcpConnectionInterceptorSupport tcpConnectionInterceptorSupport && !this.theConnection.equals(this)) { | ||
| if (this.theConnection instanceof TcpConnectionInterceptorSupport tcpConnectionInterceptorSupport | ||
| && !this.theConnection.equals(this)) { | ||
|
|
||
| tcpConnectionInterceptorSupport.removeDeadConnection(this); | ||
| } | ||
| TcpSender sender = getSender(); | ||
| if (sender != null && this.interceptedSenders != null && !(sender instanceof TcpConnectionInterceptorSupport)) { | ||
| this.interceptedSenders.forEach(snder -> snder.removeDeadConnection(connection)); | ||
| if (sender != null && this.interceptedSenders != null | ||
| && !(sender instanceof TcpConnectionInterceptorSupport)) { | ||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Blank line can probably be removed.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well, my preference for better readability is to have a blank line after multi-line |
||
| this.interceptedSenders.forEach(intercepted -> intercepted.removeDeadConnection(connection)); | ||
| } | ||
| } | ||
| finally { | ||
|
|
||
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.
Why is the
@Nullablemove to the line above the method?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.
Because this method does not have modifiers and annotation is treated by formatter as for the whole method.
I agree on consistency discrepancy here, but I prefer to keep formatter happy to avoid unnecessary changes in the future .