Skip to content
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

Merged
merged 3 commits into from
Mar 21, 2019
Merged

Support config strategy #138

merged 3 commits into from
Mar 21, 2019

Conversation

dbl-x
Copy link
Contributor

@dbl-x dbl-x commented Mar 21, 2019

  1. 支持用户提供ConnectionSelectStrategy实现(fix issue: https://github.com/alipay/sofa-bolt/issues/128)
  2. RemotingServer增加LifeCycle接口实现,统一生命周期

@dbl-x dbl-x added the dev:tuning Some improvement label Mar 21, 2019
@dbl-x dbl-x added this to the 1.6.0 release milestone Mar 21, 2019
@dbl-x dbl-x self-assigned this Mar 21, 2019
@dbl-x dbl-x requested a review from fengjiachun March 21, 2019 09:01
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);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

contains() 调用没有必要,一次 get() 即可

Copy link
Contributor Author

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() {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

为什么方法名称不使用驼峰?

Copy link
Contributor Author

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;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

构造方法传入的, final?

Copy link
Contributor Author

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();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

可不可以替换为 ThreadLocalRandom? 性能更好

Copy link
Contributor Author

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开始才有

@fengjiachun fengjiachun merged commit 8572d2f into release/1.6.0 Mar 21, 2019
@fengjiachun fengjiachun deleted the support_config_strategy branch March 21, 2019 12:08
dbl-x added a commit that referenced this pull request May 31, 2019
* 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dev:tuning Some improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants