Wait until all nodes leave barrier

@return true when required all nodes have left barrier, else wait.
@throws KeeperException      If a keeper exception occurred
@throws InterruptedException If interrupted
431195
public boolean leave() throws KeeperException, InterruptedException{
		zooKeeper.delete(rootPath + "/" + name, 0);
		while (true) {
			synchronized (mutex) {
				List<String> list = zooKeeper.getChildren(rootPath, true);
				if (list.size() > 0) {
					mutex.wait();
				} else {
					return true;
				}
			}
		}
	}
363881
public boolean doHasPrevious()
    {
        if ((m_iRecordStatus & DBConstants.RECORD_AT_BOF) != 0)
            return false; // Already at BOF (can't be one before)
        if ((m_iRecordStatus & DBConstants.RECORD_PREVIOUS_PENDING) != 0)
            return true;    // Already one waiting
        boolean bAtBOF = true;
        try   {
            FieldList record = this.move(DBConstants.PREVIOUS_RECORD);
            if (record == null)
                bAtBOF = true;
            else if ((m_iRecordStatus & DBConstants.RECORD_AT_BOF) != 0)
                bAtBOF = true;
            else if (this.isTable())
                bAtBOF = this.isBOF();
            else
                bAtBOF = false;     // Valid record!
        } catch (DBException ex)    {
            ex.printStackTrace();
        }
        if (bAtBOF)
            return false; // Does not have a next record
        m_iRecordStatus |= DBConstants.RECORD_PREVIOUS_PENDING;     // If next call is a moveNext(), return unchanged!
        return true;        // Yes, a next record exists.
    }
271315
public void waitForCloseToComplete()
   {
      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "waitForCloseToComplete");

      closeWaitersMonitor.waitOn();

      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "waitForCloseToComplete");
   }
696019
public static boolean isAllReady() throws IOException, InterruptedException {
        for (RestartListener listener : all()) {
            if (!listener.isReadyToRestart())
                return false;
        }
        return true;
    }
950318
final boolean transferAfterCancelledWait(Node node) {
        if (node.compareAndSetWaitStatus(Node.CONDITION, 0)) {
            enq(node);
            return true;
        }
        /*
         * If we lost out to a signal(), then we can't proceed
         * until it finishes its enq().  Cancelling during an
         * incomplete transfer is both rare and transient, so just
         * spin.
         */
        while (!isOnSyncQueue(node))
            Thread.yield();
        return false;
    }
1296701
@Override
    public void await() throws InterruptedException {
        queueLock.lock();
        try {
            while(test()) {
                condition.await();
            }
        }
        finally {
            queueLock.unlock();
        }
    }
860952
public void waitForSessionBound() throws InterruptedException, TimeoutException {
    // Maintain compatibility with Grid 1.x, which had the ability to
    // specify how long to wait before canceling a request.
    GridHubConfiguration configuration = getRegistry().getHub().getConfiguration();
    Integer newSessionWaitTimeout = configuration.newSessionWaitTimeout != null ?
                                    configuration.newSessionWaitTimeout : 0;
    if (newSessionWaitTimeout > 0) {
      if (!sessionAssigned.await(newSessionWaitTimeout.longValue(), TimeUnit.MILLISECONDS)) {
        throw new TimeoutException("Request timed out waiting for a node to become available.");
      }
    } else {
      // Wait until a proxy becomes available to handle the request.
      sessionAssigned.await();
    }
  }
427715
public void awaitCompletion() throws InterruptedException {
    boolean performedWarning = false;

    while (hasInflightOperations()) {
      synchronized (signal) {
        if (hasInflightOperations()) {
          signal.wait(finishWaitMillis);
        }
      }

      long now = clock.nanoTime();
      if (now >= noSuccessCheckDeadlineNanos) {
        logNoSuccessWarning(now);
        resetNoSuccessWarningDeadline();
        performedWarning = true;
      }
    }
    if (performedWarning) {
      LOG.info("awaitCompletion() completed");
    }
  }
257121
protected boolean prepareClose() {
        synchronized (lock) {
            final State state = this.state;
            if (state == State.OPEN) {
                this.state = State.CLOSING;
                lock.notifyAll();
                return true;
            }
        }
        return false;
    }
781221
private synchronized boolean waitForContent()
        throws InterruptedIOException
    {
        if (_buffer!=null)
        {
            if (_buffer.hasRemaining())
                return true;
             
             // recycle buffer
             recycle(_buffer);
             _buffer=null;
        }        
        
        while(!_closed && LazyList.size(_buffers)==0)
        {
            try
            {
                this.wait(_timeout);
            }
            catch(InterruptedException e)
            {
                log.debug(e);
                throw new InterruptedIOException(e.toString());
            }
        }    
        
        if (_closed)
            return false;
            
        if (LazyList.size(_buffers)==0)
            throw new SocketTimeoutException();
        
        _buffer=(ByteBuffer)LazyList.get(_buffers, 0);
        _buffers=LazyList.remove(_buffers, 0);
        
        return true;
    }
1253144
public void blockClose() throws InterruptedException {
        // If the thread is new, it will never run, since we closed the connection before we actually connected
        if (writer.getInnerThread().getState() != Thread.State.NEW) {
            writer.getInnerThread().join();
        }
        getInnerThread().join();
    }
1354829
private void waitForInputChannelsToBeClosed() throws IOException, InterruptedException {
		// Wait for disconnection of all output gates
		while (true) {

			// Make sure, we leave this method with an InterruptedException when the task has been canceled
			if (this.executionObserver.isCanceled()) {
				throw new InterruptedException();
			}

			boolean allClosed = true;
			for (int i = 0; i < getNumberOfInputGates(); i++) {
				final InputGate<? extends IOReadableWritable> eig = this.inputGates.get(i);
				if (!eig.isClosed()) {
					allClosed = false;
				}
			}

			if (allClosed) {
				break;
			}
			else {
				Thread.sleep(SLEEPINTERVAL);
			}
		}
	}
658754
public static boolean isPartitionCleanupInProgress(ZooKeeper zk) throws KeeperException, InterruptedException
    {
        List<String> children = zk.getChildren(VoltZK.leaders_initiators, null);
        List<ZKUtil.ChildrenCallback> childrenCallbacks = Lists.newArrayList();
        for (String child : children) {
            ZKUtil.ChildrenCallback callback = new ZKUtil.ChildrenCallback();
            zk.getChildren(ZKUtil.joinZKPath(VoltZK.leaders_initiators, child), false, callback, null);
            childrenCallbacks.add(callback);
        }

        for (ZKUtil.ChildrenCallback callback : childrenCallbacks) {
            if (callback.get().isEmpty()) {
                return true;
            }
        }

        return false;
    }
1011794
public E take() throws InterruptedException {
        final ReentrantLock lock = this.lock;
        lock.lockInterruptibly();
        try {
            for (;;) {
                E first = q.peek();
                if (first == null)
                    available.await();
                else {
                    long delay = first.getDelay(NANOSECONDS);
                    if (delay <= 0L)
                        return q.poll();
                    first = null; // don't retain ref while waiting
                    if (leader != null)
                        available.await();
                    else {
                        Thread thisThread = Thread.currentThread();
                        leader = thisThread;
                        try {
                            available.awaitNanos(delay);
                        } finally {
                            if (leader == thisThread)
                                leader = null;
                        }
                    }
                }
            }
        } finally {
            if (leader == null && q.peek() != null)
                available.signal();
            lock.unlock();
        }
    }
1318359
public boolean waitForWithOptions() throws InterruptedException {
    try {
      // [START ]
      Job completedJob =
          job.waitFor(
              RetryOption.initialRetryDelay(Duration.ofSeconds(1)),
              RetryOption.totalTimeout(Duration.ofMinutes(1)));
      if (completedJob == null) {
        // job no longer exists
      } else if (completedJob.getStatus().getError() != null) {
        // job failed, handle error
      } else {
        // job completed successfully
      }
      // [END ]
    } catch (BigQueryException e) {
      if (e.getCause() instanceof PollException) {
        return false;
      }
      throw e;
    }
    return true;
  }
1279933
public boolean waitForCompletion(long duration, TimeUnit timeUnit) throws InterruptedException {
    synchronized (lock) {
      if (!isCompleted()) {
        lock.wait(timeUnit.toMillis(duration));
      }
      return isCompleted();
    }
  }
516940
private void await() {
    try {
      // Clean up all filter join leaf nodes that have been converted
      boolean nodeRemoved = this.removeConvertedNodes(root);
      // If some nodes were removed, it means that we converted in the previous iteration
      // at least one filter join into a field data terms query. We don't have to wait since
      // we might have new filter join leaf nodes.
      if (!nodeRemoved && root.hasChildren()) {
        logger.debug("Visitor thread block - blocking queue size: {}", blockingQueue.size());
        this.blockingQueue.take();   // block until one async action is completed
        this.blockingQueue.offer(0); // add back the element to the queue, it will be removed after the node conversion
        logger.debug("Visitor thread unblock - blocking queue size: {}", blockingQueue.size());
      }
    }
    catch (InterruptedException e) {
      logger.warn("Filter join visitor thread interrupted while waiting");
      Thread.currentThread().interrupt();
    }
  }