Waits until a connection is available on the wire, or until
        the connection is in a state that it can't accept messages.
        It returns True if a message is available, False otherwise.
340237
def wait_message(self):
        
        if self._state != states['open']:
            return False
        if len(self._read_queue) > 0:
            return True

        assert self._read_waiter is None or self._read_waiter.cancelled(), \
            "You may only use one wait_message() per connection."

        self._read_waiter = asyncio.Future(loop=self._loop)
        yield from self._read_waiter
        return self.wait_message()
622045
def wait_while_reachable(self, servers, timeout=60):
        
        t_start = time.time()
        while True:
            try:
                for server in servers:
                    # TODO: use state code to check if server is reachable
                    server_info = self.connection(
                        hostname=server, timeout=5).admin.command('ismaster')
                    logger.debug("server_info: {server_info}".format(server_info=server_info))
                    if int(server_info['ok']) != 1:
                        raise pymongo.errors.OperationFailure("{server} is not reachable".format(**locals))
                return True
            except (KeyError, AttributeError, pymongo.errors.AutoReconnect, pymongo.errors.OperationFailure):
                if time.time() - t_start > timeout:
                    return False
                time.sleep(0.1)
59400
private void onConnectSucceeded(){
        LOGGER.info("Accepted the connection.");

        isConnected = true;
        isConnecting = false;
        enableReadOnly();
        synchronized(connectHolder){
            connectHolder.notifyAll();
        }
    }
581761
def wait_for(self, predicate, timeout=None):
        
        if not is_locked(self._lock):
            raise RuntimeError('lock is not locked')
        hub = get_hub()
        try:
            with switch_back(timeout, lock=thread_lock(self._lock)) as switcher:
                handle = add_callback(self, switcher, predicate)
                # See the comment in Lock.acquire() why it is OK to release the
                # lock here before calling hub.switch().
                # Also if this is a reentrant lock make sure it is fully released.
                state = release_save(self._lock)
                hub.switch()
        except BaseException as e:
            with self._lock:
                remove_callback(self, handle)
            if e is switcher.timeout:
                return False
            raise
        finally:
            acquire_restore(self._lock, state)
        return True
720177
async def wait_message(self):
        """"""
        if not self._queue.empty():
            return True
        if self._queue.closed:
            return False
        await self._queue.wait()
        return self.is_active
279795
def wait(self):
        
        if self.error:
            raise self.error
        if not self.running:
            raise ValueError("Unable to send until client has been started.")
        try:
            self._handler.wait()
        except (errors.TokenExpired, errors.AuthenticationException):
            log.info("Sender disconnected due to token error. Attempting reconnect.")
            self.reconnect()
        except (errors.LinkDetach, errors.ConnectionClose) as shutdown:
            if shutdown.action.retry and self.auto_reconnect:
                log.info("Sender detached. Attempting reconnect.")
                self.reconnect()
            else:
                log.info("Sender detached. Shutting down.")
                error = EventHubError(str(shutdown), shutdown)
                self.close(exception=error)
                raise error
        except errors.MessageHandlerError as shutdown:
            if self.auto_reconnect:
                log.info("Sender detached. Attempting reconnect.")
                self.reconnect()
            else:
                log.info("Sender detached. Shutting down.")
                error = EventHubError(str(shutdown), shutdown)
                self.close(exception=error)
                raise error
        except Exception as e:
            log.info("Unexpected error occurred (%r).", e)
            raise EventHubError("Send failed: {}".format(e))
1170312
def __wait_for_one_server_connection(self):
        

        _logger.info("Waiting for first connection.")

        while 1:
            is_connected_to_one = False
            for (n, c, g) in self.__connections:
                if c.is_connected is True:
                    is_connected_to_one = True
                    break
                elif g.exception == nsq.exceptions.NsqConnectGiveUpError:
                    raise IOError("One of the servers could not be connected "
                                  "during startup: [%s]" % (c))
                elif g.exception is not None:
                    raise IOError("One of the connection gthreads had an "
                                  "uncaught exception during startup: [%s] "
                                  "[%s]" % 
                                  (g.exception.__class__.__name__, 
                                   str(g.exception)))
                elif g.dead is True:
                    raise SystemError("One of the connection gthreads died "
                                      "during startup: [%s]" % (c,))

            if is_connected_to_one is True:
                break

            gevent.sleep(nsq.config.client.CONNECT_AUDIT_WAIT_INTERVAL_S)
1067704
def wait_while(self, condition, *args, **kw):
    
    return self.wait_for(lambda: not condition(), *args, **kw)
496266
def _wait(self, timeout=None):
        
        r, w, x = select.select([self._stick_file], [], [], timeout)
        return bool(r)
291596
def wait_for_service(self, interval=1):
        
        while self.status in (OnlineModel.Status.DEPLOYING, OnlineModel.Status.UPDATING):
            time.sleep(interval)
        if self.status == OnlineModel.Status.DEPLOY_FAILED:
            raise OnlineModelError(self.last_fail_msg, self)
        elif self.status != OnlineModel.Status.SERVING:
            raise OnlineModelError('Unexpected status occurs: %s' % self.status.value, self)
132815
def wait_for_service_available(container, url, timeout):
    
    start = time.time()
    remaining = timeout
    while True:
        remaining = start + timeout - time.time()
        if remaining < 0:
            raise ServiceTimeout
        try:
            response = get(url,
                timeout=min(remaining, REQUEST_TIMEOUT_SECONDS))
            if 500 <= response.status_code < 600:
                return False
            return True
        except (ConnectionError, Timeout):
            pass
        if not inspect_container(container)['State']['Running']:
            return False

        remaining = start + timeout - time.time()
        delay = max(0, min(RETRY_DELAY_SECONDS, remaining))
        time.sleep(delay)

    raise ServiceTimeout
334288
private void doSend(byte[] msg, boolean wait, KNXAddress dst)
		throws KNXAckTimeoutException, KNXLinkClosedException
	{
		if (closed)
			throw new KNXLinkClosedException("link closed");
		try {
			logger.info("send message to " + dst + (wait ? ", wait for ack" : ""));
			logger.trace("EMI " + DataUnitBuilder.toHex(msg, " "));
			conn.send(msg, wait);
			logger.trace("send to " + dst + " succeeded");
		}
		catch (final KNXPortClosedException e) {
			logger.error("send error, closing link", e);
			close();
			throw new KNXLinkClosedException("link closed, " + e.getMessage());
		}
	}
131645
def _wait(lfunc, log_lvl=None, log_msg=None, tries=10):
    '''
    
    '''
    i = 0
    while i < tries:
        time.sleep(1)

        if lfunc():
            return True
        else:
            i += 1
    if log_lvl is not None:
        log.log(LOG[log_lvl], log_msg)
    return False
240775
def wait_for_net(self, timeout=None, wait_polling_interval=None):
        
        if timeout is None:
            timeout = self._timeout
        if wait_polling_interval is None:
            wait_polling_interval = self._wait_polling_interval

        self._logger.info("Waiting for network connection")
        poll_wait(self.get_ip_address, timeout=timeout)
482731
def wait(self, duration=None, count=0):
        
        start = time.time()
        total = 0
        while True:
            type, result = self._recv(MSG, PING, OK)
            if type is MSG:
                total += 1
                if self._handle_msg(result) is False:
                    break

                if count and total >= count:
                    break

            elif type is PING:
                self._handle_ping()

            if duration and time.time() - start > duration:
                break
349556
protected synchronized boolean checkConnection()
    {
        if (_connection==null)
        {
            try{
                _connection=_url.openConnection();
            }
            catch(IOException e)
            {
                LogSupport.ignore(log,e);
            }
        }
        return _connection!=null;
    }
1089358
def wait(self):
        
        if self._go:
            return True

        with self.lock:
            if self._go:
                return True
            stopper = _allocate_lock()
            stopper.acquire()
            if not self.waiting_threads:
                self.waiting_threads = [stopper]
            else:
                self.waiting_threads.append(stopper)

        DEBUG and self._name and Log.note("wait for go {{name|quote}}", name=self.name)
        stopper.acquire()
        DEBUG and self._name and Log.note("GOing! {{name|quote}}", name=self.name)
        return True