[Wisp] Fix initialization problem between JavaNetSocketAccess and its usage#443
Open
zhengxiaolinX wants to merge 1 commit into
Open
[Wisp] Fix initialization problem between JavaNetSocketAccess and its usage#443zhengxiaolinX wants to merge 1 commit into
zhengxiaolinX wants to merge 1 commit into
Conversation
yuleil
reviewed
Nov 17, 2022
| pb.start(); | ||
| ss.accept(); | ||
| } catch (Exception e) { | ||
| e.printStackTrace(); |
Collaborator
There was a problem hiding this comment.
Use Asserts.fail() for better readability
… usage Summary: JavaNetSocketAccess is used in WispServerSocketImpl.java, but the former one's initialization is in Socket.java. This underlying problem shall be fixed. Test Plan: ServerSocketConnectionTest.java Reviewed-by: D-D-H, yuleil Issue: #437
cdbee46 to
558b5b2
Compare
D-D-H
reviewed
Nov 21, 2022
| public class ServerSocketConnectionTest { | ||
|
|
||
| private static final String CLIENT = "SimpleClient"; | ||
| private static final String PORT = "4039"; |
Collaborator
There was a problem hiding this comment.
IMHO, using a random port makes the test more stable.
Collaborator
There was a problem hiding this comment.
use 0
port – the port number, or 0 to use a port number that is automatically allocated.
| PORT // port | ||
| ); | ||
| pb.start(); | ||
| ss.accept(); |
Collaborator
There was a problem hiding this comment.
accept after started? is this intentional?
D-D-H
reviewed
Nov 21, 2022
| @@ -148,6 +149,7 @@ private static void initializeClasses() { | |||
| Class.forName(ShutdownEngine.class.getName()); | |||
| Class.forName(AbstractShutdownTask.class.getName()); | |||
| Class.forName(ShutdownControlGroup.class.getName()); | |||
Collaborator
There was a problem hiding this comment.
Please add some comments to explain why we need this.
yuleil
reviewed
Dec 5, 2022
| Class.forName(ShutdownEngine.class.getName()); | ||
| Class.forName(AbstractShutdownTask.class.getName()); | ||
| Class.forName(ShutdownControlGroup.class.getName()); | ||
| Class.forName(Socket.class.getName()); |
Collaborator
There was a problem hiding this comment.
JavaNetSocketAccess is only used by ServerSocket, I suggest moving setJavaNetSocketAccess from Socket.<clinit> to ServerSocket.<clinit>. Thus, we don't need to preload Socket.class.
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.
Summary: JavaNetSocketAccess is used in WispServerSocketImpl.java, but the former one's initialization is in Socket.java. This underlying problem shall be fixed.
Test Plan: ServerSocketConnectionTest.java
Reviewed-by: D-D-H, yuleil
Issue: #437