-
Notifications
You must be signed in to change notification settings - Fork 863
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
Support config strategy #138
Conversation
dbl-x
commented
Mar 21, 2019
- 支持用户提供ConnectionSelectStrategy实现(fix issue: https://github.com/alipay/sofa-bolt/issues/128)
- RemotingServer增加LifeCycle接口实现,统一生命周期
public int netty_buffer_low_watermark() { | ||
if (configContainer.contains(configType, ConfigItem.NETTY_BUFFER_LOW_WATER_MARK)) { | ||
return (Integer) configContainer | ||
.get(configType, ConfigItem.NETTY_BUFFER_LOW_WATER_MARK); |
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.
contains() 调用没有必要,一次 get() 即可
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.
已优化
} | ||
|
||
@Override | ||
public int netty_buffer_high_watermark() { |
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.
为什么方法名称不使用驼峰?
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.
历史原因,无法修改
private final Random random = new Random(); | ||
|
||
private GlobalSwitch globalSwitch; |
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.
构造方法传入的, final?
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.
已添加
private static final int MAX_TIMES = 5; | ||
|
||
/** random */ | ||
private final Random random = new Random(); |
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.
可不可以替换为 ThreadLocalRandom? 性能更好
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.
bolt目前需要支持JDK 1.6版本,ThreadLocalRandom从1.7开始才有
* Add LifeCycle component and refactor some code. (#113) * Make getAfterRun un-block avoid deadlock. (#107) (#109) * update readme * update version to 1.6.0-SNAPSHOT * 修改RpcClientDemoByMain 和RpcServerDemoByMain 的logger引用对象 (#112) * 修改日志引用的对象 * add lifecycle component * fix NPE in ReconnectManager and refactor some code * Refactor some components with LifeCycle interface. (#114) Refactor some components with LifeCycle interface. * Refactor RpcClient with LifeCycle interface and add option module. (#116) Refactor RpcClient with LifeCycle interface and add option module. * fix #131 (#132) * refactor DefaultConnectionManager to fix issue: #131 * refactory ConnectionManager to support start/shutdown operations (#135) * 重构ScheduledDisconnectStrategy实现 (#136) * refactory ConnectionManager to support start/shutdown operations * Reconnector class is used instead of ReconnectManager class * refactor ScheduledDisconnectStrategy * Support config strategy (#138) * support config user ConnectionSelectStrategy impl * add LifeCycle interface to RemotingServer * fix some code according to CR * fix #137 (#141) * update version 1.6.0-SNAPSHOT->1.6.0