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

[TUBEMQ-232] TubeBroker#register2Master, reconnect and wait #148

Merged
merged 1 commit into from Jun 11, 2020

Conversation

viviel
Copy link
Contributor

@viviel viviel commented Jun 10, 2020

If the broker fails to register with the master, a total of 5 reconnections will be attempted. But I think we should pause the thread for a period of time every time the connection fails to be reconnected

for (int i; i < reconnectionTimes; i++) {
    try {
        tryConnect();
    } catch (Throwable e) {
        try {
            TimeUnit.MILLISECONDS.sleep(200);
        } catch (InterruptedException ignored) {
            //ignore interrupted
        }
    }
}

@@ -430,6 +430,11 @@ private void register2Master() throws StartupException {
if (remainingRetry == 0) {
throw new StartupException("Register to master failed!", e);
}
try {
TimeUnit.MILLISECONDS.sleep(200);
Copy link
Contributor

Choose a reason for hiding this comment

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

use ThreadUtil.sleep to replace this

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ha, thanks for the reminder

Copy link
Contributor

@Technoboy- Technoboy- left a comment

Choose a reason for hiding this comment

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

+1

Copy link
Member

@guangxuCheng guangxuCheng left a comment

Choose a reason for hiding this comment

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

lgtm +1

@guangxuCheng guangxuCheng merged commit 1c2bdf5 into apache:master Jun 11, 2020
xuehuanran pushed a commit to xuehuanran/inlong that referenced this pull request Dec 22, 2022
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.

None yet

4 participants