final double absoluteDeadline = (timeout > 0.0) ? (Time.now() + timeout) : 0.0; while (absoluteDeadline == 0.0 || absoluteDeadline > Time.now()) { Preconditions.checkState(mState == State.OPEN, "Cannot get ZKClient %s in state %s.", this, mState); try { if (absoluteDeadline > 0) { final double waitTimeout = absoluteDeadline - Time.now(); // seconds mMonitor.wait((long) (waitTimeout * 1000.0)); } else {
final double absoluteDeadline = (timeout > 0.0) ? Time.now() + timeout : 0.0; if (mZKClient.exists(preceding, mLockWatcher) != null) { if (absoluteDeadline > 0.0) { final long timeLeftMS = (long) ((absoluteDeadline - Time.now()) * 1000); if (timeLeftMS <= 0) { LOG.debug("{}: out of time while acquiring lock, deleting {}",
public boolean lock(double timeout) throws IOException { final double absoluteDeadline = (timeout > 0.0) ? Time.now() + timeout : 0.0; if (mZKClient.checkExists().usingWatcher(mLockWatcher).forPath(preceding) != null) { if (absoluteDeadline > 0.0) { final long timeLeftMS = (long) ((absoluteDeadline - Time.now()) * 1000); if (timeLeftMS <= 0) { LOG.debug("{}: out of time while acquiring lock, deleting {}",