Enhancements in transport-netty-http and properties related#161
Enhancements in transport-netty-http and properties related#161sczyh30 merged 2 commits intoalibaba:masterfrom
Conversation
Codecov Report
@@ Coverage Diff @@
## master #161 +/- ##
============================================
- Coverage 51.15% 50.49% -0.66%
+ Complexity 822 818 -4
============================================
Files 139 140 +1
Lines 4737 4749 +12
Branches 672 674 +2
============================================
- Hits 2423 2398 -25
- Misses 2030 2066 +36
- Partials 284 285 +1
Continue to review full report at Codecov.
|
cfff90c to
0cd7c34
Compare
| if (serverSocket != null) { | ||
| int finalPort = serverSocket.getLocalPort(); | ||
| try { | ||
| serverSocket.close(); |
There was a problem hiding this comment.
It's not a good idea to create server with available port, then close the socket and return the detected port. Once you closed the socket, the port may be released and other processes can take up this port before the port can be used by Sentinel transport later, which can cause error.
There was a problem hiding this comment.
netty-http want to get a port number while simple-http want to get a ServerSocket.
So what about add a retry with new base port in netty-http? that's just like the old logic in simple-http.
There was a problem hiding this comment.
That's okay to add retry logic in sentinel-transport-netty-http (though full of boilerplate), just ensure the server hold the connection where the port is available. You can put the NetUtil class to sentinel-transport-simple-http if it cannot be commonly reused :)
There was a problem hiding this comment.
Or i have a solution and figuring it out if it's efficient. We can turn on REUSE_ADDR option and the port will remain TIME_WAIT for a while(even we hacked the kernel, in 1 second) and we can safely use it in a short time.
sentinel-core/pom.xml
Outdated
| <plugin> | ||
| <groupId>org.apache.maven.plugins</groupId> | ||
| <artifactId>maven-jar-plugin</artifactId> | ||
| <version>3.0.2</version> |
There was a problem hiding this comment.
You can add the version to <properties>...</properties> like:
<!-- Use the latest version here -->
<maven.jar.version>3.1.0</maven.jar.version>There was a problem hiding this comment.
yeah, I will add it as pluginManagement in parent pom
| import com.alibaba.csp.sentinel.util.PidUtil; | ||
|
|
||
| /** | ||
| * Add support for placeholders in java.util.logging |
There was a problem hiding this comment.
Here is used to describe the whole class. It's better to remove the description and author information here.
| * | ||
| * @author youji.zj | ||
| */ | ||
| @SuppressWarnings("rawtypes") |
There was a problem hiding this comment.
Do not add this to class level. If really necessary, add to lower level (e.g. method level).
sentinel-core/src/main/java/com/alibaba/csp/sentinel/util/VersionUtil.java
Show resolved
Hide resolved
| /** | ||
| * Get Sentinel version from MANIFEST.MF | ||
| * | ||
| * @author jason<jason@dayima.com> @ Sep 28, 2018 |
There was a problem hiding this comment.
You can remove the redundant author information (email, date) and only keep name here. Also, add a @since 0.2.1 here to indicate this is a new class since next version. Please also modify this in other new-created classes.
fc48c91 to
2ff69f4
Compare
|
Hi, can you resolve the conflicts? |
It has been done |
sczyh30
left a comment
There was a problem hiding this comment.
The CI indicates a build failure. Could you please resolve it?
| /** | ||
| * Change log dir, the dir will be created if not exits | ||
| */ | ||
| public static void resetLogBaseDir(String baseDir) { |
There was a problem hiding this comment.
The reset function has been deprecated and you can remove it from the log classes.
3e8e44f to
6ba04b6
Compare
|
@sczyh30 all done last night |
|
Thanks for your contribution! |
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
Add:
Fix: