Skip to content

Add close method to Helix lock#1077

Merged
jiajunwang merged 3 commits intoapache:masterfrom
mgao0:lock
Jun 10, 2020
Merged

Add close method to Helix lock#1077
jiajunwang merged 3 commits intoapache:masterfrom
mgao0:lock

Conversation

@mgao0
Copy link
Contributor

@mgao0 mgao0 commented Jun 9, 2020

Issues

  • My PR addresses the following Helix issues and references them in the PR description:

Currently there is no close method to close the lock and the underlying zk client connection. It could result to zk client leak.

Description

  • Here are some details about my PR, including screenshots of any UI changes:

Added a close() method to the interface and implementation of the lock, where the zk client will be closed. User will need to call this when they don't need to use the lock any more to avoid zk connection leakage.

Tests

  • The following tests are written for this issue:
    TestZKHelixNonblockingLock.testCloseLockedLock
    TestZKHelixNonblockingLock.testCloseUnlockedLock

  • The following is the result of the "mvn test" command on the appropriate module:

[INFO] Results:
[INFO]
[INFO] Tests run: 6, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 53.817 s
[INFO] Finished at: 2020-06-09T16:09:54-07:00
[INFO] ------------------------------------------------------------------------

Commits

  • My commits all reference appropriate Apache Helix GitHub issues in their subject lines. In addition, my commits follow the guidelines from "How to write a good git commit message":
    1. Subject is separated from body by a blank line
    2. Subject is limited to 50 characters (not including Jira issue reference)
    3. Subject does not end with a period
    4. Subject uses the imperative mood ("add", not "adding")
    5. Body wraps at 72 characters
    6. Body explains "what" and "why", not "how"

Code Quality

  • My diff has been formatted using helix-style.xml
    (helix-style-intellij.xml if IntelliJ IDE is used)

@mgao0 mgao0 changed the title Add close method Add close method to Helix lock Jun 9, 2020
@mgao0
Copy link
Contributor Author

mgao0 commented Jun 9, 2020

This PR is ready to be merged, approved by @jiajunwang.
Final commit message: Add a close method to Helix lock interface and current implementation to avoid ZK connection leakage

@jiajunwang jiajunwang merged commit f54c684 into apache:master Jun 10, 2020
@mgao0 mgao0 deleted the lock branch June 11, 2020 00:37
huizhilu pushed a commit to huizhilu/helix that referenced this pull request Aug 16, 2020
Add a close method to Helix lock interface and current implementation to avoid ZK connection leakage.
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