Same as doWebRequest, but with built in wait-looping
514037
def doWaitWebRequest(url, method="GET", data=None, headers={}):
    

    completed = False
    while not completed:
        completed = True
        try:
            response, content = doWebRequest(url, method, data, headers)
        except urllib2.URLError:
            completed = False
            waitForURL(url)
    return response, content
1038584
private void asyncMoreRequest(int startRow) {
    try {
      DataRequest moreRequest = new DataRequest();
      moreRequest.queryId = queryId;
      moreRequest.startRow = startRow;
      moreRequest.maxSize = maxBatchSize;
      logger.debug("Client requesting {} .. {}", startRow, (startRow + maxBatchSize - 1));

      DataResponse response = server.data(moreRequest);
      logger.debug("Client got response {} .. {}, more={}",
          new Object[] { response.startRow, (response.startRow + response.data.size() - 1), response.more });
      nextData.add(new Window(response.data, response.more));
    } catch (AvroRemoteException e) {
      this.nextData.addError(toSparqlException(e));
    } catch (Throwable t) {
      this.nextData.addError(t);
    }
  }
408952
function wait() {
  var ms = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;

  return new Promise(function (res) {
    return setTimeout(res, ms);
  });
}
217988
def wait(self, timeout=None):
        
        if self._thread is None:
            return
        self._thread.join(timeout=timeout)
254793
private void awaitRequestsCompletion() throws IOException {
    // Don't wait until all requests will be completed if enough requests are pending for full batch
    while (!responseFutures.isEmpty() && pendingRequests.size() < maxRequestsPerBatch) {
      try {
        responseFutures.remove().get();
      } catch (InterruptedException | ExecutionException e) {
        if (e.getCause() instanceof IOException) {
          throw (IOException) e.getCause();
        }
        throw new RuntimeException("Failed to execute batch", e);
      }
    }
  }
708621
def _wait_until(obj, att, desired, callback, interval, attempts, verbose,
        verbose_atts):
    
    if not isinstance(desired, (list, tuple)):
        desired = [desired]
    if verbose_atts is None:
        verbose_atts = []
    if not isinstance(verbose_atts, (list, tuple)):
        verbose_atts = [verbose_atts]
    infinite = (attempts == 0)
    attempt = 0
    start = time.time()
    while infinite or (attempt < attempts):
        try:
            # For servers:
            obj.get()
        except AttributeError:
            try:
                # For other objects that don't support .get()
                obj = obj.manager.get(obj.id)
            except AttributeError:
                # punt
                raise exc.NoReloadError("The 'wait_until' method is not "
                        "supported for '%s' objects." % obj.__class__)
        attval = getattr(obj, att)
        if verbose:
            elapsed = time.time() - start
            msgs = ["Current value of %s: %s (elapsed: %4.1f seconds)" % (
                    att, attval, elapsed)]
            for vatt in verbose_atts:
                vattval = getattr(obj, vatt, None)
                msgs.append("%s=%s" % (vatt, vattval))
            print(" ".join(msgs))
        if attval in desired:
            return obj
        time.sleep(interval)
        attempt += 1
    return obj
1105384
def batch!(request, request_options = {})
      res = batch(request, request_options)
      wait_task(res['taskID'], WAIT_TASK_DEFAULT_TIME_BEFORE_RETRY, request_options)
      res
    end
148681
public void waitForCompletion() throws InterruptedException {
        try {
            waitForCompletion(0L);
        } catch (AsyncTimeoutException ate) {
            // cannot happen since arg of 0L means wait forever
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "Unexpected timeout on blocking wait call, exception: " + ate.getMessage());
            }
            FFDCFilter.processException(ate,
                                        getClass().getName() + ".waitForCompletion", "268", this);
            InterruptedException ie = new InterruptedException("Unexpected timeout");
            ie.initCause(ate);
            throw ie;
        }
    }
1200191
def _wait(self, generator, method, timeout=None, *args, **kwargs):
        """"""
        if self.debug:
            print("waiting for %s to pause" % generator)

        original_timeout = timeout
        while timeout is None or timeout > 0:
            last_time = time.time()
            if self._lock.acquire(False):  # timeout param was added in 3.2
                try:
                    if self.can_resume():
                        return method(generator, *args, **kwargs)
                    elif self.has_terminated():
                        raise RuntimeError("%s has already terminated" % generator)
                finally:
                    self._lock.release()

            if timeout is not None:
                timeout -= time.time() - last_time

        msg = "%s did not pause after %ss" % (generator, original_timeout)
        if self.debug:
            print(msg)
        raise WaitTimeoutError(msg)
128350
private boolean waitForAdd(long waitStart, long maxWait) throws InterruptedException {
        while (this.size == 0) {
            if (!waitOnCondition(this.notEmpty, maxWait, waitStart)) {
                return false;
            }
        }

        return true;
    }
1138283
def wait_process(self):
        """"""
        self.process.wait()
        if self.analyze_data:
            self.receiving_thread.join()
1075085
def _wait_for_handles(handles, timeout=-1):
    
    arrtype = HANDLE * len(handles)
    handle_array = arrtype(*handles)

    ret = windll.kernel32.WaitForMultipleObjects(
        len(handle_array), handle_array, BOOL(False), DWORD(timeout))

    if ret == WAIT_TIMEOUT:
        return None
    else:
        h = handle_array[ret]
        return h
703363
private ProcessResult waitFor(WaitForProcess task) throws IOException, InterruptedException, TimeoutException {
    ProcessResult result;
    if (timeout == null) {
      // Use the current thread
      result = task.call();
    }
    else {
      // Fork another thread to invoke Process.waitFor()
      ExecutorService service = newExecutor(task);
      // Copy values to not conflict with further executions
      long _timeout = timeout;
      TimeUnit unit = timeoutUnit;
      try {
        result = invokeSubmit(service, task).get(_timeout, unit);
      }
      catch (ExecutionException e) {
        Throwable c = e.getCause();
        if (c instanceof IOException) {
          throw (IOException) c;
        }
        if (c instanceof InterruptedException) {
          throw (InterruptedException) c;
        }
        if (c instanceof InvalidExitValueException) {
          InvalidExitValueException i = (InvalidExitValueException) c;
          throw new InvalidExitValueException(i.getMessage(), i.getResult());
        }
        if (c instanceof InvalidOutputException) {
          InvalidOutputException i = (InvalidOutputException) c;
          throw new InvalidOutputException(i.getMessage(), i.getResult());
        }
        if (c.getClass().equals(InvalidResultException.class)) {
          InvalidResultException p = (InvalidResultException) c;
          throw new InvalidResultException(p.getMessage(), p.getResult());
        }
        throw new IllegalStateException("Error occured while waiting for process to finish:", c);
      }
      catch (TimeoutException e) {
        messageLogger.message(log, "{} is running too long", task);
        throw newTimeoutException(_timeout, unit, task);
      }
      finally {
        // Interrupt the task if it's still running and release the ExecutorService's resources
        service.shutdownNow();
      }
    }
    return result;
  }
451538
def wait(self, timeout):
    

    with self._condition:
      previous_iteration = self._iteration
      self._condition.wait(timeout)
      return previous_iteration != self._iteration
547134
def wait(self, timeout=None):
        
        import threading

        if self._state!=self.PENDING:
            return

        e = threading.Event()
        self.addCallback(lambda v: e.set())
        self.addErrback(lambda r: e.set())
        e.wait(timeout)
429885
void waitBetweenFrames(int transDelayMS, long lastTransactionTimestamp) {

        // If a fixed delay has been set
        if (transDelayMS > 0) {
            ModbusUtil.sleep(transDelayMS);
        }
        else {
            // Make use we have a gap of 3.5 characters between adjacent requests
            // We have to do the calculations here because it is possible that the caller may have changed
            // the connection characteristics if they provided the connection instance
            int delay = getInterFrameDelay() / 1000;

            // How long since the last message we received
            long gapSinceLastMessage = (System.nanoTime() - lastTransactionTimestamp) / NS_IN_A_MS;
            if (delay > gapSinceLastMessage) {
                long sleepTime = delay - gapSinceLastMessage;

                ModbusUtil.sleep(sleepTime);

                if (logger.isDebugEnabled()) {
                    logger.debug("Waited between frames for {} ms", sleepTime);
                }
            }
        }
    }
714383
private void waitIndexingNotSuspended() {
        boolean suspendedNotified = false;
        synchronized (suspendLock) {
            while (suspend > 0) {
                if (!suspendedNotified) {
                    suspendedNotified = true;
                }
                try {
                    suspendLock.wait();
                } catch (InterruptedException ex) {
                }
            }
        }
    }