Blocks until a result is available, or timeout milliseconds have elapsed. Needs to be called with lock held
@param timeout in ms
@return An object
@throws TimeoutException If a timeout occurred (implies that timeout > 0)
177229
protected T _getResultWithTimeout(final long timeout) throws TimeoutException {
        if(timeout <= 0)
            cond.waitFor(this::hasResult);
        else if(!cond.waitFor(this::hasResult, timeout, TimeUnit.MILLISECONDS))
            throw new TimeoutException();
        return result;
    }
687421
public void setConnectionTimeout(long connectionTimeout, TimeUnit timeUnit) {
		this.connectionTimeoutInMs = TimeUnit.MILLISECONDS.convert(connectionTimeout, timeUnit);
	}
473258
private void timeout() {
        lock.writeLock().lock();
        try {
            //if already stopped, do nothing, otherwise check times and run the timeout task
            if (!this.stopped) {
                long now = System.nanoTime();
                long remaining = this.targetEnd - now;
                this.timedout = remaining <= FTConstants.MIN_TIMEOUT_NANO;

                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                    debugTime("!Start  {0}", this.start);
                    debugTime("!Target {0}", this.targetEnd);
                    debugTime("!Now    {0}", now);
                    debugTime("!Remain {0}", remaining);
                }

                //if we really have timedout then run the timeout task
                if (this.timedout) {
                    debugRelativeTime("Timeout!");
                    this.timeoutTask.run();
                } else {
                    //this shouldn't be possible but if the timer popped too early, restart it
                    debugTime("Premature Timeout!", remaining);
                    start(this.timeoutTask, remaining);
                }
            }
        } finally {
            lock.writeLock().unlock();
        }
    }
1273429
public void setTimeout(int timeout) {
    this.timeout = timeout;
    try {
      socket.setSoTimeout(timeout);
    } catch (SocketException sx) {
      LOGGER.warn("Could not set socket timeout.", sx);
    }
  }
300671
public function block($timeout, $callback = null)
    {
        $starting = time();

        while (! $this->acquire()) {
            if (time() - $timeout >= $starting) {
                throw new LimiterTimeoutException;
            }

            usleep(750 * 1000);
        }

        if (is_callable($callback)) {
            $callback();
        }

        return true;
    }
77678
@Override
	public T get(@SuppressWarnings("unused") long timeout, @SuppressWarnings("unused") TimeUnit unit) throws InterruptedException, ExecutionException
	{
		if(exception != null)
			throw new ExecutionException(exception);
		return returnValue;
	}
1231425
def timeout(self, timeout=None):
        
        if timeout is None:
            return self.__timeout
        if 0 < float(timeout) < 3600:
            self.__timeout = float(timeout)
            return self.__timeout
        else:
            return None
978816
public void setConnectTimeout(int timeout) {
        Assert.isTrue(timeout >= 0, "Timeout must be a non-negative value");
        this.httpClient.getHttpConnectionManager().getParams().setConnectionTimeout(timeout);
    }
1119462
public EmbeddedGobblin setShutdownTimeout(String timeout) {
    return setShutdownTimeout(Period.parse(timeout).getSeconds(), TimeUnit.SECONDS);
  }
1164076
public void waitUntilComplete(long timeout) {
        long base=System.currentTimeMillis();
        long now=0;
        lock.lock();
        try {
            while(processing || count.get() > 0) {
                long delay=timeout-now;
                if(delay <= 0)
                    break;
                try {
                    processing_done.await(delay, TimeUnit.MILLISECONDS);
                    now=System.currentTimeMillis()-base;
                }
                catch(InterruptedException e) {
                }
            }
        }
        finally {
            lock.unlock();
        }
    }
412300
@Override
    public V poll(long timeout, TimeUnit unit) throws InterruptedException {
        return blockingQueue.poll(timeout, unit);
    }
89326
public void await(long timeout, TimeUnit unit) throws InterruptedException, TimeoutException {
        if (!latch.await(timeout, unit)) {
            throw new TimeoutException();
        }
    }
542898
public boolean waitForResponse ()
        throws TimeoutException
    {
        if (_success == 0) {
            synchronized (this) {
                try {
                    // wait for the response, timing out after a while
                    if (_timeout == NO_TIMEOUT) {
                        wait();

                    } else {
                        wait(1000L * _timeout);
                    }
                    // if we get here without some sort of response, then we've timed out
                    if (_success == 0) {
                        throw new TimeoutException();
                    }

                } catch (InterruptedException ie) {
                    throw (TimeoutException)
                        new TimeoutException().initCause(ie);
                }
            }
        }

        return (_success > 0);
    }
327413
public void processTimeout(TimeoutEvent timeoutEvent) {
        Transaction transaction = null;
        if(timeoutEvent.isServerTransaction()) {
            transaction = timeoutEvent.getServerTransaction();
            if(logger.isDebugEnabled()) {
                logger.debug("timeout => " + transaction.getRequest().toString());
            }
        } else {
            transaction = timeoutEvent.getClientTransaction();
            if(logger.isDebugEnabled()) {
                logger.debug("timeout => " + transaction.getRequest().toString());
            }
        }
        String callId = ((CallIdHeader)transaction.getRequest().getHeader(CallIdHeader.NAME)).getCallId();
        register.unStickSessionFromNode(callId);
    }
921678
def _get_timeout(self, timeout):
        
        if timeout is _Default:
            return self.timeout.clone()

        if isinstance(timeout, Timeout):
            return timeout.clone()
        else:
            # User passed us an int/float. This is for backwards compatibility,
            # can be removed later
            return Timeout.from_float(timeout)
300680
@Override
  public void setTimeout(int timeout) throws SocketException {
    lock.lock();
    try {
      this.socket.setSoTimeout(timeout);
    } finally {
      lock.unlock();
    }
  }
845848
public Timeout getTimeoutLeft()
	{
		final long left = getTimeLeft();

		if (left != 0)
			return new Timeout(left, TimeUnit.MILLISECONDS);
		else
			return Timeout.ZERO;
	}