Add close method to Helix lock#1077
Merged
jiajunwang merged 3 commits intoapache:masterfrom Jun 10, 2020
Merged
Conversation
jiajunwang
reviewed
Jun 9, 2020
helix-lock/src/main/java/org/apache/helix/lock/helix/ZKDistributedNonblockingLock.java
Show resolved
Hide resolved
helix-lock/src/test/java/org/apache/helix/lock/helix/TestZKHelixNonblockingLock.java
Show resolved
Hide resolved
zhangmeng916
reviewed
Jun 9, 2020
zhangmeng916
reviewed
Jun 9, 2020
helix-lock/src/main/java/org/apache/helix/lock/helix/ZKDistributedNonblockingLock.java
Show resolved
Hide resolved
jiajunwang
approved these changes
Jun 9, 2020
Contributor
Author
|
This PR is ready to be merged, approved by @jiajunwang. |
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issues
Currently there is no close method to close the lock and the underlying zk client connection. It could result to zk client leak.
Description
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
Code Quality
(helix-style-intellij.xml if IntelliJ IDE is used)