-
Notifications
You must be signed in to change notification settings - Fork 8.7k
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
bugfix: configuration exceptions lead to increased CPU usage #2391
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #2391 +/- ##
=============================================
- Coverage 51.80% 51.80% -0.01%
Complexity 2696 2696
=============================================
Files 517 517
Lines 16761 16764 +3
Branches 2028 2028
=============================================
+ Hits 8683 8684 +1
- Misses 7267 7269 +2
Partials 811 811
|
@@ -306,7 +308,9 @@ public FileListener(String dataId, ConfigurationChangeListener listener) { | |||
|
|||
@Override | |||
public void onChangeEvent(ConfigurationChangeEvent event) { | |||
while (true) { | |||
ScheduledExecutorService onChangeEventExecutor = |
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.
I think ScheduledExecutorService would be instantiate more time if I listen different config.
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.
PTAL @l81893521
测试当前PR分支结果复现错误,CPU性能正常。理论上在生产环境是不会产生该异常。 复现错误当前classLoader: RestartClassLoader 异常信息
|
@threefish how long will it not output an exception?or is it always exist? |
try { | ||
Thread.sleep(LISTENER_CONFIG_INTERNAL); | ||
} catch (InterruptedException e) { | ||
e.printStackTrace(); |
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.
use
LOGGER.error
instead of
e.printStackTrace();
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.
use
LOGGER.error
instead of
e.printStackTrace();
ok
LOGGER.error("fileListener execute error:{}", exx.getMessage()); | ||
} | ||
try { | ||
Thread.sleep(LISTENER_CONFIG_INTERNAL); |
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 help correct the spelling by the way.Thank you!
LISTENER_CONFIG_INTERNAL->LISTENER_CONFIG_INTERVAL
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.
LISTENER_CONFIG_INTERVAL
ok
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.
cpu has behaved normally。
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.
cpu has behaved normally。
If there are no questions, please reply to PTAL separately
cpu has behaved normally。thanks |
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
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
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
Ⅰ. Describe what this PR did
optimize file configuration reading
Ⅱ. Does this pull request fix one issue?
#2387
Ⅲ. Why don't you add test cases (unit test/integration test)?
Ⅳ. Describe how to verify it
Ⅴ. Special notes for reviews