Returns a new source that delegates to {@code source}, using this to
implement timeouts. This works best if {@link #timedOut} is overridden to
interrupt {@code sink}'s current operation.
498445
public final Source source(final Source source) {
    return new Source() {
      @Override public long read(Buffer sink, long byteCount) throws IOException {
        boolean throwOnTimeout = false;
        enter();
        try {
          long result = source.read(sink, byteCount);
          throwOnTimeout = true;
          return result;
        } catch (IOException e) {
          throw exit(e);
        } finally {
          exit(throwOnTimeout);
        }
      }

      @Override public void close() throws IOException {
        boolean throwOnTimeout = false;
        try {
          source.close();
          throwOnTimeout = true;
        } catch (IOException e) {
          throw exit(e);
        } finally {
          exit(throwOnTimeout);
        }
      }

      @Override public Timeout timeout() {
        return AsyncTimeout.this;
      }

      @Override public String toString() {
        return "AsyncTimeout.source(" + source + ")";
      }
    };
  }
884773
@SuppressWarnings("unchecked")
  public final <T> T get(final String key, final long timeout)
      throws TimeoutException, InterruptedException, MemcachedException {
    return (T) this.get(key, timeout, this.transcoder);
  }
948027
@Override
  public byte[] brpoplpush(final byte[] source, final byte[] destination, final int timeout) {
    client.brpoplpush(source, destination, timeout);
    client.setTimeoutInfinite();
    try {
      return client.getBinaryBulkReply();
    } finally {
      client.rollbackTimeout();
    }
  }
867698
@Override
    public T drain() {
        T event = delayed.drain();
        if (event != null) {
            return event;
        }

        return source.drain();
    }
1184513
protected PoolWaitFuture<E> createFuture(final PoolKey<K> key) {
		return new PoolWaitFuture<E>(lock) {
			protected E getPoolObject(long timeout, TimeUnit unit) throws IOException, InterruptedException, TimeoutException {
				return getBlockingUntilAvailableOrTimeout(key, timeout, unit, this);
			}
		};
	}
982060
public final Connection connectNow(Duration timeout) {
		Objects.requireNonNull(timeout, "timeout");
		try {
			return Objects.requireNonNull(connect().block(timeout), "aborted");
		}
		catch (IllegalStateException e) {
			if (e.getMessage().contains("blocking read")) {
				throw new IllegalStateException("TcpClient couldn't be started within "
						+ timeout.toMillis() + "ms");
			}
			throw e;
		}
	}
246562
public SourceUnit addSource(URL url) {
        return addSource(new SourceUnit(url, configuration, classLoader, getErrorCollector()));
    }
666363
public static Timeout create(long timeout, TimeUnit timeUnit) {

        LettuceAssert.notNull(timeUnit, "TimeUnit must not be null");

        return new Timeout(Duration.ofNanos(timeUnit.toNanos(timeout)));
    }
147175
public B from(FlowNode source) {
    element.setSource(source);
    source.getOutgoing().add(element);
    return myself;
  }
1113702
public <T> T convert(Object source, Class<T> toClass) {
        return toClass.cast(source.toString());
    }
1062449
@Override
    public DataByteInput<T> source(final T source) {
        return (DataByteInput<T>) super.source(source);
    }
701622
public GroovyCodeSource createGroovyCodeSource(final ClassSource source) throws IOException {
    checkNotNull(source);

    if (source.getUrl() != null) {
      return new GroovyCodeSource(source.getUrl());
    }
    if (source.getFile() != null) {
      return new GroovyCodeSource(source.getFile());
    }
    if (source.getInline() != null) {
      Inline inline = source.getInline();
      return new GroovyCodeSource(inline.getInput(), inline.getName(), inline.getCodeBase());
    }

    throw new Error("Unable to create GroovyCodeSource from: " + source);
  }
891174
@Override
    public synchronized Response get(long timeout, TimeUnit unit)
            throws InterruptedException, ExecutionException, TimeoutException {
        long now = System.currentTimeMillis();
        long mills = unit.toMillis(timeout);
        long toWait = mills;
        if (this.completed) {
            return this.getResult();
        } else if (toWait <= 0) {
            throw new TimeoutException("Timeout is smaller than 0.");
        } else {
            for (;;) {
                wait(toWait);
                if (this.completed) {
                    return this.getResult();
                }
                long gap = System.currentTimeMillis() - now;
                toWait = toWait - gap;
                if (toWait <= 0) {
                    throw new TimeoutException();
                }
            }
        }
    }
1374845
@GET
    @Suspend(period = 60, timeUnit = TimeUnit.SECONDS, listeners = {EventsLogger.class})
    @Path("timeout")
    public Broadcastable timeout() {
        return new Broadcastable(broadcaster);
    }
1119462
public EmbeddedGobblin setShutdownTimeout(String timeout) {
    return setShutdownTimeout(Period.parse(timeout).getSeconds(), TimeUnit.SECONDS);
  }
1118825
public static TimeoutException newTimeoutException(String message, java.util.concurrent.TimeoutException cause) {
        return new TimeoutException(message, cause);
    }
1321183
public static <K, V> TimedCache<K, V> newTimedCache(long timeout){
		return new TimedCache<K, V>(timeout);
	}