Selects and waits .
@param timeout Milliseconds.
@return
@throws IOException
973387
public int select(long timeout) throws IOException
    {
        fine("select("+timeout+")");
        lock.lock();
        try
        {
            ensureAllRunning();
            try
            {
                SelKey sk = queue.poll(timeout, TimeUnit.MILLISECONDS);
                if (sk != null)
                {
                    selectedKeys.add(sk);
                    queue.drainTo(selectedKeys);
                    selectedKeys.remove(WAKEUP_KEY);
                    return selectedKeys.size();
                }
                else
                {
                    fine("select() timeout");
                    return 0;
                }
            }
            catch (InterruptedException ex)
            {
                fine("select() interrupted");
                return 0;
            }
        }
        finally
        {
            lock.unlock();
        }
    }
1043730
private static void wait(Object lock, int timeout)
  {
    try {
      lock.wait(timeout);
    }
    catch(InterruptedException unused) {
      Thread.currentThread().interrupt();
    }
  }
577192
public BlockingListMaker<K, E> waitFor(long time, TimeUnit unit) {
        this.nanoTimeout = time == 0 ? 1 : NANOSECONDS.convert(time, unit);
        return this;
    }
921669
public void get(long timeout, TimeUnit unit) throws InterruptedException, TimeoutException {
        sync.innerGet(unit.toNanos(timeout));
    }
1164919
public Message<?> receive(MessageSelector selector, long timeout) {
        long timeLeft = timeout;
        Message<?> message = receive(selector);

        while (message == null && timeLeft > 0) {
            timeLeft -= pollingInterval;
            
            if (RETRY_LOG.isDebugEnabled()) {
                RETRY_LOG.debug("No message received with message selector - retrying in " + (timeLeft > 0 ? pollingInterval : pollingInterval + timeLeft) + "ms");
            }
            
            try {
                Thread.sleep(timeLeft > 0 ? pollingInterval : pollingInterval + timeLeft);
            } catch (InterruptedException e) {
                RETRY_LOG.warn("Thread interrupted while waiting for retry", e);
            }
            
            message = receive(selector);
        }
        
        return message;
    }
306986
public static <T> CompletableFuture<T> orTimeout(CompletableFuture<T> future, long timeout, TimeUnit timeUnit) {
		return orTimeout(future, timeout, timeUnit, Executors.directExecutor());
	}
1201034
public static void wait(Object lock, long timeout) {
	try {
	    synchronized (lock) {
		lock.wait(timeout);
	    }
	}
	catch (InterruptedException e) {}
    }
228529
public void setReadTimeout(int timeout) {
		Assert.isTrue(timeout >= 0, "Timeout must be a non-negative value");
		getHttpClient().getParams().setIntParameter(CoreConnectionPNames.SO_TIMEOUT, timeout);
	}
58251
public long getTimeout()
  {
    if (tc.isEntryEnabled()) 
      SibTr.entry(tc, "getTimeout");
      
    long timeout = aiValueTick.getOriginalTimeout();
        
    if (tc.isEntryEnabled()) 
      SibTr.exit(tc, "getTimeout", new Long(timeout));
    return timeout;
  }
845110
def wait_for_connection(self, timeout=None):
        
        if timeout is not None:
            wait_time = timeout / 10.0
        else:
            wait_time = None
        with self.__connect_wait_condition:
            while self.running and not self.is_connected() and not self.connection_error:
                self.__connect_wait_condition.wait(wait_time)
        if not self.running or not self.is_connected():
            raise exception.ConnectFailedException()
217886
def _wait_for_io_events(socks, events, timeout=None):
    
    if not HAS_SELECT:
        raise ValueError('Platform does not have a selector')
    if not isinstance(socks, list):
        # Probably just a single socket.
        if hasattr(socks, "fileno"):
            socks = [socks]
        # Otherwise it might be a non-list iterable.
        else:
            socks = list(socks)
    with DefaultSelector() as selector:
        for sock in socks:
            selector.register(sock, events)
        return [key[0].fileobj for key in
                selector.select(timeout) if key[1] & events]
592637
public void setResponseTimeout(int timeout) {
        try {
            getConnection().setReadTimeout(timeout);
        } catch (Exception e) {
            Modbus.log().warning(e.getLocalizedMessage());
        }
    }
217988
def wait(self, timeout=None):
        
        if self._thread is None:
            return
        self._thread.join(timeout=timeout)
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();
        }
    }
311385
public void setTimeout(long timeout, TimeUnit unit) {
        this.timeout = timeout;
        this.unit    = unit;
        c.setTimeout(timeout, unit);
    }
451538
def wait(self, timeout):
    

    with self._condition:
      previous_iteration = self._iteration
      self._condition.wait(timeout)
      return previous_iteration != self._iteration
575858
public void processTimeout(TimeoutEvent timeout) {
    ClientTransaction trans = timeout.getClientTransaction();
    if (trans == null) {
      return;
    }

    SipTransaction sip_trans = null;
    synchronized (respTransactions) {
      sip_trans = (SipTransaction) respTransactions.get(trans);
    }

    if (sip_trans == null) {
      return;
    }

    if (trans.getState().getValue() == TransactionState._TERMINATED) {
      synchronized (respTransactions) {
        respTransactions.remove(trans);
      }
    }

    // check for listener handling
    MessageListener listener = sip_trans.getClientListener();
    if (listener != null) {
      listener.processEvent(timeout);
      return;
    }

    // if no listener, use the default blocking mechanism
    synchronized (sip_trans.getBlock()) {
      sip_trans.getEvents().addLast(timeout);
      sip_trans.getBlock().notifyEvent();
    }
  }