[TARGET waitFor(RetryOption...)]
12959
public boolean waitFor() throws InterruptedException {
    try {
      // [START ]
      Job completedJob = job.waitFor();
      if (completedJob == null) {
        // job no longer exists
      } else if (completedJob.getStatus().getError() != null) {
        // job failed, handle error
      } else {
        // job completed successfully
      }
      // [END ]
    } catch (BigQueryException e) {
      // Timeouts shouldn't happen without a timeout option.
      if (e.getCause() instanceof PollException) {
        return false;
      }
      throw e;
    }
    return true;
  }
912455
async function retryPromise(fn, attempts, backoff) {
    let aborted = false;

    try {
        const data = await fn(() => { aborted = true; });
        return data;
    }
    catch (e) {
        if (aborted || ((backoff.attempts + 1) >= attempts)) {
            throw e;
        }

        const duration = backoff.duration();
        debug(`Promise rejected attempt #${backoff.attempts}, retrying in ${duration}ms: ${e.message}`);

        await Promise.delay(duration);
        return retryPromise(fn, attempts, backoff);
    }
}
799463
def retry_until_true(wait=0.5, &block)
      EM::Timer.new(wait) do
        unless block.call
          retry_until_true(wait, &block)
        end
      end
    end
158195
function wait(testCallback, waitCallback) {
          if (!testCallback()) {
            // Wait for timeout
            if ((new Date().getTime()) - startTime < maxLoadTime) {
              Delay.setTimeout(waitCallback);
            } else {
              failed();
            }
          }
        }
867629
def retry(self, msg, e, retry_num, waittime):
        ''' 
        '''
        self.msg.error_message(msg)
        self.msg.error_message(e)
        self.msg.error_message("Attempt number " + str(retry_num) + ". Retrying in " + str(waittime) + " seconds.")
        time.sleep(waittime)
775900
public <T> boolean waitForResource(int res, int timeout) {
        int RETRY_PERIOD = 250;
        int retryNum = timeout / RETRY_PERIOD;
        for (int i = 0; i < retryNum; i++) {
            T View = (T) this.getView(res);
            if (View != null) {
                break;
            }
            if (i == retryNum - 1) {
                return false;
            }
            this.sleep(RETRY_PERIOD);
        }
        return true;
    }
933392
public void wait(int retry) {
        long sleepMillis = BACKOFF[Math.min(retry, BACKOFF.length - 1)] * 1000L;
        try {
            Thread.sleep(sleepMillis);
        } catch (InterruptedException ie) {
            Thread.currentThread().interrupt();
            throw new WebbException(ie);
        }
    }
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;
  }
1352003
def wait_for(self,
               condition,
               interval = DEFAULT_WAIT_INTERVAL,
               timeout  = DEFAULT_WAIT_TIMEOUT):
    

    start = time.time()

    # at least execute the check once!
    while True:
      res = condition()
      if res:
        return res

      # timeout?
      if time.time() - start > timeout:
        break

      # wait a bit
      time.sleep(interval)

    # timeout occured!
    raise WaitTimeoutError("wait_for timed out")
1302831
public void waitForUpdate() {

        CmsWaitHandle handle = new CmsWaitHandle(true);
        addWaitHandle(handle);
        handle.enter(Long.MAX_VALUE);
    }
1278567
void waitForResuming() throws IOException
   {
      if (isSuspended.get())
      {
         try
         {
            latcher.get().await();
         }
         catch (InterruptedException e)
         {
            throw new IOException(e);
         }
      }
   }
1266242
def wait(self):
        
        ret = os.read(self.event_fd, 64 / 8)
        return struct.unpack('Q', ret)
291821
def wait(self):
        
        self.thread.join()
        if self.error is not None:
            return self.error
        return self.result
399099
public void await(K k, long timeout, TimeUnit unit) throws InterruptedException, TimeoutException {
        if (!acquireLock(k).await(timeout, unit)) {
            throw new TimeoutException("Wait time for retrieving value for key " + k + " exceeded " + timeout + " " + unit);
        }
    }
659592
def wait_func_accept_retry_state(wait_func):
    """"""
    if not six.callable(wait_func):
        return wait_func

    if func_takes_retry_state(wait_func):
        return wait_func

    if func_takes_last_result(wait_func):
        @_utils.wraps(wait_func)
        def wrapped_wait_func(retry_state):
            warn_about_non_retry_state_deprecation(
                'wait', wait_func, stacklevel=4)
            return wait_func(
                retry_state.attempt_number,
                retry_state.seconds_since_start,
                last_result=retry_state.outcome,
            )
    else:
        @_utils.wraps(wait_func)
        def wrapped_wait_func(retry_state):
            warn_about_non_retry_state_deprecation(
                'wait', wait_func, stacklevel=4)
            return wait_func(
                retry_state.attempt_number,
                retry_state.seconds_since_start,
            )
    return wrapped_wait_func
412549
private Set<Location> waitForTasksCompleted() {
        try {
            Set<Location> targets = new HashSet<>();
            FutureTask<Set<Location>> task;
            while ((task = tasks.poll()) != null) {
                // wait for completion
                if (!task.isDone())
                    targets.addAll(task.get());
            }
            return targets;
        } catch (InterruptedException|ExecutionException e) {
            throw new Error(e);
        }
    }
633544
def wait(self, timeout):
        ''''''
        logger.debug('Waiting for %fs', timeout)
        return self._event.wait(timeout)