You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@curator.apache.org by "Jordan Zimmerman (JIRA)" <ji...@apache.org> on 2019/05/21 20:10:00 UTC
[jira] [Commented] (CURATOR-521) LeaderLatch closed with
CloseMode=null does not close
[ https://issues.apache.org/jira/browse/CURATOR-521?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16845215#comment-16845215 ]
Jordan Zimmerman commented on CURATOR-521:
------------------------------------------
A PR with the fix would be appreciated
> LeaderLatch closed with CloseMode=null does not close
> ------------------------------------------------------
>
> Key: CURATOR-521
> URL: https://issues.apache.org/jira/browse/CURATOR-521
> Project: Apache Curator
> Issue Type: Bug
> Components: Recipes
> Affects Versions: 4.2.0
> Reporter: Yuri Tceretian
> Priority: Trivial
>
> The class LeaderLatch has two methods `close`, one of them accepts argument `CloseMode`. If the argument is null (unlikely but still possible) the instance changes the state to CLOSED but does not really close anything because throws a runtime exception `closeMode cannot be null` right after changing the status.
> [https://github.com/apache/curator/blob/a3514d87b1036716e5dc9877c9980fdd81440458/curator-recipes/src/main/java/org/apache/curator/framework/recipes/leader/LeaderLatch.java#L201-L205]
> The quickest fix is to just swap preconditions checks. The more correct solution is to change state in the try block after the client removed all watchers (or in finally block). It should not break anything because the method is synchronized.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)