-
Notifications
You must be signed in to change notification settings - Fork 826
JAVA-539 cse.request.timeout support dynamic refresh #281
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
Conversation
TcpClientConfig tcpClientConfig = new TcpClientConfig(); | ||
tcpClientConfig.setRequestTimeoutMillis(AbstractTransport.getRequestTimeout()); | ||
DynamicLongProperty prop = AbstractTransport.getRequestTimeoutProperty(); | ||
prop.addCallback(new Runnable(){ |
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 better to add a comment on this line to support setup the request timeout dynamically.
|
||
private static final long DEFAULT_TIMEOUT_MILLIS = 30000; | ||
|
||
private static final String DEFAULT_TIMEOUT_KEY = "cse.request.timeout"; |
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.
Please change the constant to REQUEST_TIMEOUT_KEY.
ConfigUtil.installDynamicConfig(); | ||
AbstractConfiguration configuration = | ||
(AbstractConfiguration) DynamicPropertyFactory.getBackingConfigurationSource(); | ||
configuration.addProperty("cse.request.timeout", 2000); |
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.
Please using the constant value like REQUEST_TIMEOUT_KEY here.
msRequestTimeout = msTimeout; | ||
return msRequestTimeout; | ||
public static DynamicLongProperty getRequestTimeoutProperty(){ | ||
return DynamicPropertyFactory.getInstance().getLongProperty(REQUEST_TIMEOUT_KEY, DEFAULT_TIMEOUT_MILLIS); |
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.
no need to create the property every time.
@laijianbin There are two PR for the same issue, please close the PR which you don't want us to merge. |
no use |
No description provided.