private Task<Void> release() {
    return PlanLocal.get(getPlanLocalKey(), LockInternal.class).flatMap(lockInternal -> {
      // should never be null.
      if (lockInternal == null) {
        LOG.error("LockInternal is null when releasing lock: ", _lockPath);
      } else {
        lockInternal._lockCount--;
        if (lockInternal._lockCount == 0) {

          return PlanLocal.remove(getPlanLocalKey())
              .flatMap(unused ->
                  _zkClient.delete(lockInternal._lockNode, -1)
                      .recover(e -> {
                        _zkClient.deleteNode(lockInternal._lockNode);
                        return null;
                      })
              );
        }
      }
      return Task.value(null);
    });
  }
private Task<Void> release() {
    return PlanLocal.get(getPlanLocalKey(), LockInternal.class).flatMap(lockInternal -> {
      
      if (lockInternal == null) {
        LOG.error("LockInternal is null when releasing lock: ", _lockPath);
      } else {
        lockInternal._lockCount--;
        if (lockInternal._lockCount == 0) {

          return PlanLocal.remove(getPlanLocalKey())
              .flatMap(unused ->
                  _zkClient.delete(lockInternal._lockNode, -1)
                      .recover(e -> {
                        _zkClient.deleteNode(lockInternal._lockNode);
                        return null;
                      })
              );
        }
      }
      return Task.value(null);
    });
  }
private Task < Void > release ( ) { return PlanLocal . get ( getPlanLocalKey ( ) , LockInternal . class ) . flatMap ( lockInternal -> { // should never be null. if ( lockInternal == null ) { LOG . error ( "LockInternal is null when releasing lock: " , _lockPath ) ; } else { lockInternal . _lockCount -- ; if ( lockInternal . _lockCount == 0 ) { return PlanLocal . remove ( getPlanLocalKey ( ) ) . flatMap ( unused -> _zkClient . delete ( lockInternal . _lockNode , - 1 ) . recover ( e -> { _zkClient . deleteNode ( lockInternal . _lockNode ) ; return null ; } ) ) ; } } return Task . value ( null ) ; } ) ; }
Try to release the lock.
Try to release the lock .