poll the response queue for response

@param timeout timeout amount
@param timeUnit timeUnit of timeout
@return same result of BlockQueue.poll(long, TimeUnit)
@throws InterruptedException
420139
public synchronized Response<ByteArray, Object> responseQueuePoll(long timeout,
                                                                      TimeUnit timeUnit)
            throws InterruptedException {
        long timeoutMs = timeUnit.toMillis(timeout);
        long timeoutWallClockMs = System.currentTimeMillis() + timeoutMs;
        while(responseQueue.isEmpty() && System.currentTimeMillis() < timeoutWallClockMs) {
            long remainingMs = Math.max(0, timeoutWallClockMs - System.currentTimeMillis());
            if(logger.isDebugEnabled()) {
                logger.debug("Start waiting for response queue with timeoutMs: " + timeoutMs);
            }
            this.wait(remainingMs);
            if(logger.isDebugEnabled()) {
                logger.debug("End waiting for response queue with timeoutMs: " + timeoutMs);
            }
        }
        return responseQueue.poll();
    }
1052297
@Override
    public boolean await(long timeout, TimeUnit unit) throws InterruptedException {
        if (log.isDebugEnabled()) log.debug("Current Latch Count = " + latch.getCount() + "; await for "+ timeout + " " + unit.name() + " appName : " + appName);
        final long start = log.isDebugEnabled() ? System.currentTimeMillis() : 0;
        final boolean awaitSuccess = latch.await(timeout, unit);
        if (log.isDebugEnabled()) log.debug("await success = " + awaitSuccess + " after " + (System.currentTimeMillis() - start) + " msec." + " appName : " + appName + ((evcacheEvent != null) ? " keys : " + evcacheEvent.getEVCacheKeys() : ""));
        return awaitSuccess;
    }
988013
public ConverterServerBuilder requestTimeout(long timeout, TimeUnit unit) {
        assertNumericArgument(timeout, true);
        this.requestTimeout = unit.toMillis(timeout);
        return this;
    }
461491
@Override
	public E poll(long timeout, TimeUnit unit) throws InterruptedException {
		E e = queue.poll(timeout, unit);
		if (e != null){
			signalSizeReduced();
		}
		return e;
	}
459585
public TransactionalProtocolClient.PreparedOperation<T> retrievePreparedOperation(final long timeout, final TimeUnit timeUnit) throws InterruptedException {
        return queue.poll(timeout, timeUnit);
    }
548864
public Integer awaitStatusCode(long timeout, TimeUnit timeUnit) {
        try {
            if (!awaitCompletion(timeout, timeUnit)) {
                throw new DockerClientException("Awaiting status code timeout.");
            }
        } catch (InterruptedException e) {
            throw new DockerClientException("Awaiting status code interrupted: ", e);
        }

        return getStatusCode();
    }
214578
public final boolean tryLockForRead(L locker, long timeout, TimeUnit unit)
        throws InterruptedException
    {
        if (Thread.interrupted()) {
            throw new InterruptedException();
        }
        if (!tryLockForRead(locker)) {
            return lockForReadQueuedInterruptibly(locker, addReadWaiter(), unit.toNanos(timeout));
        }
        return true;
    }
579152
@Override
    public final T poll(final long timeout, final TimeUnit unit) throws InterruptedException {
        final long start = getWriteLockWithOptionalWait(timeout, unit);
        if (start == Long.MIN_VALUE) {
            // Min value signals a timeout while waiting
            return null;
        }
        final long maxWait = start >= 0 ? unit.toMillis(timeout) : -1;

        try {
            // Wait for an element to be available to return
            if (!this.waitForAdd(start, maxWait)) {
                return null;
            }

            return this.pollInternal(false);
        } finally {
            this.writeLock.unlock();
        }
    }
855883
void doAwaitUntil() throws InterruptedException {
        lock.lock();
        try {
            condition.await(DEFAULT_TIMEOUT_MILLISECONDS, TimeUnit.MILLISECONDS);
        } finally {
            lock.unlock();
        }
    }
1161547
public static int waitForWithTimeout(final Process p, long timeout, TimeUnit unit)
      throws TimeoutException {

    ProcessThread t = new ProcessThread(p);
    t.start();
    try {
      unit.timedJoin(t, timeout);

    } catch (InterruptedException e) {
      t.interrupt();
      Thread.currentThread().interrupt();
    }

    if (!t.hasFinished()) {
      throw new TimeoutException("Process did not finish within timeout");
    }

    return t.exitValue();
  }
960971
public boolean cancel(int timeout, TimeUnit timeoutUnit) throws InterruptedException {
        if (isCanceled()) {
            return true;
        }

        cancelLatch.countDown();

        try {
            return doneLatch.await(timeout, timeoutUnit);
        } finally {
            new DefaultCurrentProcess().infanticide();
        }
    }
996082
@Override
  public <T> T run(long timeout, TimeUnit unit,
                   Consumer<Result<T>> task)
  {
    try (OutboxAmp outbox = OutboxAmp.currentOrCreate(this)) {
      ResultFuture<T> future = new ResultFuture<>();
      
      task.accept(future);
      
      return future.get(timeout, unit);
    }
  }
89326
public void await(long timeout, TimeUnit unit) throws InterruptedException, TimeoutException {
        if (!latch.await(timeout, unit)) {
            throw new TimeoutException();
        }
    }
1345710
public void await(long weight, long timeout, TimeUnit unit) throws InterruptedException, TimeoutException {
        try {
            lock.lockInterruptibly();
            while (isPermit(weight) == false) {
                condition.await(timeout, unit);
            }
        } finally {
            lock.unlock();
        }
    }
1254837
@Override
    public T take() throws InterruptedException {
        T old = poll();

        while (old == null) {
            waitGet_(-1);
            old = poll();
        }

        return old;
    }
180938
public final T blockResult(long timeout) throws TError, CancelException {
		Thread t;
		BlockedThreadHandler blockedHandler;
		synchronized (this) {
			if (unblocked && listenersInline == null) {
				if (error != null) throw error;
				if (cancel != null) throw cancel;
				return result;
			}
			t = Thread.currentThread();
			blockedHandler = Threading.getBlockedThreadHandler(t);
			if (blockedHandler == null)
				while (!unblocked || listenersInline != null)
					try { this.wait(timeout < 0 ? 0 : timeout); }
					catch (InterruptedException e) { return null; }
		}
		if (blockedHandler != null)
			blockedHandler.blocked(this, timeout);
		if (error != null) throw error;
		if (cancel != null) throw cancel;
		return result;
	}
1054581
def _blocking_poll(self, timeout=None):
        
        if self._result_set:
            return

        retry_ = self._retry.with_deadline(timeout)

        try:
            retry_(self._done_or_raise)()
        except exceptions.RetryError:
            raise concurrent.futures.TimeoutError(
                "Operation did not complete within the designated " "timeout."
            )