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

KAFKA-4856: make unregisterAppInfo method to synchronized #3696

Closed
wants to merge 1 commit into from

Conversation

omkreddy
Copy link
Contributor

No description provided.

@omkreddy
Copy link
Contributor Author

minor fix to avoid error logs
cc @ijuma

@@ -61,7 +61,7 @@ public static void registerAppInfo(String prefix, String id) {
}
}

public static void unregisterAppInfo(String prefix, String id) {
public static synchronized void unregisterAppInfo(String prefix, String id) {
Copy link
Contributor

Choose a reason for hiding this comment

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

If this must be synchronized, don't we have to do the same for registerAppInfo?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes for consistency, we can synchronize registerAppInfo method also. when multiple clients tries register mbean with the same clientId, we print an error message and continue. when multiple threads try to unregister we delete only if mbean exist in the mbean registry.

updated the PR.

Copy link
Contributor

@ijuma ijuma Aug 19, 2017

Choose a reason for hiding this comment

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

Btw, we should take the chance and make version and commitId final. Something like:

    private static final String version;
    private static final String commitId;

    static {
        Properties props = new Properties();
        try (InputStream resourceStream = AppInfoParser.class.getResourceAsStream("/kafka/kafka-version.properties")) {
            props.load(resourceStream);
        } catch (Exception e) {
            log.warn("Error while loading kafka-version.properties :" + e.getMessage());
        }
        version = props.getProperty("version", "unknown").trim();
        commitId = props.getProperty("commitId", "unknown").trim();
    }

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks. Updated the changes.

@asfgit
Copy link

asfgit commented Aug 19, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk7-scala2.11/6888/
Test PASSed (JDK 7 and Scala 2.11).

@asfgit
Copy link

asfgit commented Aug 19, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk8-scala2.12/6874/
Test PASSed (JDK 8 and Scala 2.12).

Copy link
Contributor

@ijuma ijuma left a comment

Choose a reason for hiding this comment

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

LGTM. I will merge to trunk and 0.11.0 after the tests pass.

@omkreddy
Copy link
Contributor Author

retest this please

asfgit pushed a commit that referenced this pull request Aug 22, 2017
And make AppInfo's static fields final.

Author: Manikumar Reddy <manikumar.reddy@gmail.com>

Reviewers: Ismael Juma <ismael@juma.me.uk>

Closes #3696 from omkreddy/KAFKA-4856

(cherry picked from commit 6cf92a2)
Signed-off-by: Ismael Juma <ismael@juma.me.uk>
@asfgit asfgit closed this in 6cf92a2 Aug 22, 2017
@omkreddy omkreddy deleted the KAFKA-4856 branch July 3, 2018 15:46
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.

3 participants