[SCB-1997] Small improvement when Muticastscoket receive data#1827
Merged
Conversation
liubao68
reviewed
Jun 11, 2020
Comment on lines
182
to
+187
| try { | ||
| byte[] buffer = new byte[DATA_PACKET_BUFFER_SIZE]; | ||
| multicastSocket = new MulticastSocket(PORT); | ||
| group = InetAddress.getByName(GROUP); | ||
| multicastSocket.joinGroup(group); // need to join the group to be able to receive the data | ||
|
|
||
| initMulticastSocket(); | ||
| while (true) { | ||
| DatagramPacket receivePacketBuffer = new DatagramPacket(buffer, buffer.length); | ||
| multicastSocket.receive(receivePacketBuffer); | ||
| try { |
Contributor
There was a problem hiding this comment.
Maybe need look at the outer try, if IOException is thrown, the task is exit.
Contributor
Author
There was a problem hiding this comment.
Correct. But the outer try/catch(IOException) is for initializing the Multicastsocket object ......the failure should rarely happen. I don't think we need to handle this for now. I'm thinkg to throw exception, (like our servicecomb init task)...instead of the just logging.
throw new IllegalStateException("Zero-Config init failed.", e);
liubao68
reviewed
Jun 12, 2020
Comment on lines
181
to
183
| private static void startListenerForRegisterUnregisterEvent() { | ||
| try { | ||
| byte[] buffer = new byte[DATA_PACKET_BUFFER_SIZE]; |
Contributor
There was a problem hiding this comment.
cyclomatic complexity of startListenerForRegisterUnregisterEvent is a bit too high, can be refactored.
liubao68
approved these changes
Jun 13, 2020
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow this checklist to help us incorporate your contribution quickly and easily:
[SCB-XXX] Fixes bug in ApproximateQuantiles, where you replaceSCB-XXXwith the appropriate JIRA issue.mvn clean install -Pitto make sure basic checks pass. A more thorough check will be performed on your pull request automatically.