Skip to content

[SCB-526]fetch once from dynamic config source when boot up#681

Merged
liubao68 merged 4 commits intoapache:masterfrom
liubao68:newbranch
May 3, 2018
Merged

[SCB-526]fetch once from dynamic config source when boot up#681
liubao68 merged 4 commits intoapache:masterfrom
liubao68:newbranch

Conversation

@liubao68
Copy link
Copy Markdown
Contributor

Follow this checklist to help us incorporate your contribution quickly and easily:

  • Make sure there is a JIRA issue filed for the change (usually before you start working on it). Trivial changes like typos do not require a JIRA issue. Your pull request should address just this issue, without pulling in other changes.
  • Each commit in the pull request should have a meaningful subject line and body.
  • Format the pull request title like [SCB-XXX] Fixes bug in ApproximateQuantiles, where you replace SCB-XXX with the appropriate JIRA issue.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Run mvn clean install to make sure basic checks pass. A more thorough check will be performed on your pull request automatically.
  • If this contribution is large, please file an Apache Individual Contributor License Agreement.

@liubao68
Copy link
Copy Markdown
Contributor Author

background and test cases given in https://issues.apache.org/jira/browse/SCB-526

@liubao68 liubao68 requested review from WillemJiang and wujimin April 27, 2018 07:37
@coveralls
Copy link
Copy Markdown

coveralls commented Apr 27, 2018

Coverage Status

Coverage decreased (-0.01%) to 87.378% when pulling 45398c5 on liubao68:newbranch into 20ff37b on apache:master.

request.end();
});
if (wait) {
try {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

typo, refrestTask

request.end();
});
if (wait) {
LOGGER.info("Refreshing config center members...");
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It just wait for latch, we need to write the log in the fetching method of config center client.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is a timer work, we do not print info messages in successful loop operations.

});
request.end();
});
if (wait) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

similar wait code here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

There are two steps, so got similar code.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

no need to wait response body?

EventManager.post(new ConnFailEvent("fetch config fail"));
LOGGER.error("Config refresh from {} failed.", configcenter);
}
latch.countDown();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

java.lang.Thread#getThreads is cheaper

@liubao68 liubao68 merged commit 114a752 into apache:master May 3, 2018
@liubao68 liubao68 deleted the newbranch branch March 9, 2021 10:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants