-
Notifications
You must be signed in to change notification settings - Fork 8k
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
Enhancements in transport-netty-http and properties related #161
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, I will add it as pluginManagement in parent pom
@@ -24,7 +24,10 @@ | |||
import com.alibaba.csp.sentinel.util.PidUtil; | |||
|
|||
/** | |||
* Add support for placeholders in java.util.logging |
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.
Here is used to describe the whole class. It's better to remove the description and author information here.
import com.alibaba.csp.sentinel.util.StringUtil; | ||
|
||
/*** | ||
* The simple command center provides service to exchange information. | ||
* | ||
* @author youji.zj | ||
*/ | ||
@SuppressWarnings("rawtypes") |
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reset function has been deprecated and you can remove it from the log classes.
3e8e44f
to
6ba04b6
Compare
@sczyh30 all done last night |
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.
LGTM
Thanks for your contribution! |
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
Add:
Fix: