Waits for the work to start.

@return the duration that it took for the work to start. Null if we timed out waiting.
@throws InterruptedException if interrupted while waiting.
544721
Long waitForStart() throws InterruptedException, WorkRejectedException {
        long timeout = startTimeout == WorkManager.UNKNOWN ? WorkManager.INDEFINITE : startTimeout < fudgeFactor ? fudgeFactor : startTimeout;
        Object o = startupDurationQueue.poll(timeout, TimeUnit.MILLISECONDS);
        if (o instanceof WorkRejectedException)
            throw (WorkRejectedException) o;
        else
            return (Long) o;
    }
140540
public boolean waitForCompletion() {
        try {
            return completed.get();
        } catch (InterruptedException | ExecutionException e) {
            log.warn("Failed to wait for server completion", e);
        }

        return false;
    }
750722
public T get() {
        while (true) {
            Thread t = threadVar.get();
            if (t == null) {
                return getValue();
            }
            try {
                t.join();
            } catch (InterruptedException e) {
                Thread.currentThread().interrupt(); // propagate
                return null;
            }
        }
    }
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;
	}
695785
public Long waitForProcess() throws InterruptedException {
        Long processId = waitProcessIds.peek();
        if (logger.isDebugEnabled()) {
            logger.debug("## {} get termin id [{}]", getPipelineId(), processId);
        }
        return processId;
    }
1245356
@Override
    public T waitTime(long time, TimeUnit unit) {
        return perform(new WaitTimeInteraction(new Duration(time, unit)));
    }
628206
@Override
    public T take(final com.oath.cyclops.async.wait.WaitStrategy.Takeable<T> t) throws InterruptedException {
        T result;

        while ((result = t.take()) == null) {

        }

        return result;
    }
628770
protected boolean waitForJobs() throws InterruptedException {
        final Pair<Long, Job> peekPair;
        try (Guard ignored = timeQueue.lock()) {
            peekPair = timeQueue.peekPair();
        }
        if (peekPair == null) {
            awake.acquire();
            return true;
        }
        final long timeout = Long.MAX_VALUE - peekPair.getFirst() - System.currentTimeMillis();
        if (timeout < 0) {
            return false;
        }
        return awake.tryAcquire(timeout, TimeUnit.MILLISECONDS);
    }
1035269
public void startWork(String workUnit) throws InterruptedException {
        if (waitInProgress.get())
            LOG.warn("Claiming work during wait!");
        LOG.info("Successfully claimed {}: {}. Starting...", config.workUnitName, workUnit);
        final boolean added = myWorkUnits.add(workUnit);

        if (added) {
            if (balancingPolicy instanceof MeteredBalancingPolicy) {
                MeteredBalancingPolicy mbp = (MeteredBalancingPolicy) balancingPolicy;
                Meter meter = mbp.findOrCreateMetrics(workUnit);
                ((SmartListener) listener).startWork(workUnit, meter);
            } else {
                ((ClusterListener) listener).startWork(workUnit);
            }
        } else {
            LOG.warn("Detected that %s is already a member of my work units; not starting twice!", workUnit);
        }
    }
471515
protected int getWaitPeriodInSeconds() throws ActivityException {
        String unit = super.getAttributeValue(WAIT_UNIT);
        int factor;
        if (MINUTES.equals(unit)) factor = 60;
        else if (HOURS.equals(unit)) factor = 3600;
        else if (DAYS.equals(unit)) factor = 86400;
        else factor = 1;  // Means specified value is already in seconds
        int retTime;
        String timeAttr;
        try {
            timeAttr = super.getAttributeValueSmart(WorkAttributeConstant.TIMER_WAIT);
        } catch (PropertyException e) {
            throw new ActivityException(-1, "failed to evaluate time expression", e);
        }
        retTime = StringHelper.getInteger(timeAttr, DEFAULT_WAIT);
        return retTime*factor;
    }
692101
public Object get()
        throws InterruptedException
    {
        synchronized(lock)
        {
            while (size==0)
                lock.wait();
            
            Object o = elements[head];
            elements[head]=null;
            if(++head==maxSize)
                head=0;
            if (size==maxSize)
                lock.notifyAll();
            size--;
            return o;
        }
    }
418169
private Worker getWorker() throws InterruptedException {
    while (!courtesyMonitor.allowTasksToRun()) {
      courtesyMonitor.waitFor();
    }
    while (numWorkers > maxWorkers) {
      workerQueue.take();
      numWorkers--;
    }
    return workerQueue.take();
  }
534119
public com.google.protobuf.Duration getIdleTimeout() {
    return idleTimeout_ == null ? com.google.protobuf.Duration.getDefaultInstance() : idleTimeout_;
  }
317798
public Integer getTimeout()
   {
      if (childNode.getTextValueForPatternName("timeout") != null && !childNode.getTextValueForPatternName("timeout").equals("null")) {
         return Integer.valueOf(childNode.getTextValueForPatternName("timeout"));
      }
      return null;
   }
971345
@Override
    public T take(final WaitStrategy.Takeable<T> t) throws InterruptedException {
        T result;

        while ((result = t.take()) == null) {
            Thread.yield();
        }

        return result;
    }
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();
        }
    }
369899
public int getTimeout() throws SocketException {
    if (currentProtocol != null) {
      return currentProtocol.getTimeout();
    }
    return ((urlParser.getOptions().socketTimeout == null) ? 0
        : urlParser.getOptions().socketTimeout);
  }