[SCB-526]fetch once from dynamic config source when boot up#681
[SCB-526]fetch once from dynamic config source when boot up#681liubao68 merged 4 commits intoapache:masterfrom liubao68:newbranch
Conversation
|
background and test cases given in https://issues.apache.org/jira/browse/SCB-526 |
| request.end(); | ||
| }); | ||
| if (wait) { | ||
| try { |
There was a problem hiding this comment.
Write a log for the waiting could be a good way to go.
| refreshMembers(memberDiscovery); | ||
| EXECUTOR.scheduleWithFixedDelay(new ConfigRefresh(parseConfigUtils, memberDiscovery), | ||
| refreshMembers(memberDiscovery, true); | ||
| ConfigRefresh refrestTask = new ConfigRefresh(parseConfigUtils, memberDiscovery); |
…ry pool and create/destroy thread very slow
| request.end(); | ||
| }); | ||
| if (wait) { | ||
| LOGGER.info("Refreshing config center members..."); |
There was a problem hiding this comment.
It just wait for latch, we need to write the log in the fetching method of config center client.
There was a problem hiding this comment.
This is a timer work, we do not print info messages in successful loop operations.
| }); | ||
| request.end(); | ||
| }); | ||
| if (wait) { |
There was a problem hiding this comment.
There are two steps, so got similar code.
There was a problem hiding this comment.
I removed refresh member wait logic. Because we can use the configured address and it's first time, no need to wait this operation.
| memberDiscovery.refreshMembers(buf.toJsonObject()); | ||
| }); | ||
| } | ||
| latch.countDown(); |
There was a problem hiding this comment.
no need to wait response body?
| EventManager.post(new ConnFailEvent("fetch config fail")); | ||
| LOGGER.error("Config refresh from {} failed.", configcenter); | ||
| } | ||
| latch.countDown(); |
There was a problem hiding this comment.
no need to wait response body?
…oblems; config refresh wait for body read is done.
| checkerStated = true; | ||
| // Timer may not start thread very fast so check for 3 times. | ||
| for (int i = 0; i < 3; i++) { | ||
| Set<Thread> allThreads = Thread.getAllStackTraces().keySet(); |
There was a problem hiding this comment.
java.lang.Thread#getThreads is cheaper
Follow this checklist to help us incorporate your contribution quickly and easily:
[SCB-XXX] Fixes bug in ApproximateQuantiles, where you replaceSCB-XXXwith the appropriate JIRA issue.mvn clean installto make sure basic checks pass. A more thorough check will be performed on your pull request automatically.