| Modifier and Type | Method and Description |
|---|---|
Timeout |
clearDeadline() |
Timeout |
clearTimeout() |
long |
deadlineNanoTime() |
Timeout |
deadlineNanoTime(long deadlineNanoTime) |
Timeout |
delegate() |
boolean |
hasDeadline() |
Delegate |
setDelegate(Timeout delegate) |
void |
throwIfReached()
Throws an
InterruptedIOException if the deadline has been reached or if the current
thread has been interrupted. |
Timeout |
timeout(long timeout,
TimeUnit unit) |
long |
timeoutNanos() |
deadline, waitUntilNotifiedpublic Delegate(Timeout delegate)
public final Timeout delegate()
public Timeout timeout(long timeout, TimeUnit unit)
timeout in class Timeouttimeout - longunit - TimeUnit
Wait at most timeout time before aborting an operation. Using a
per-operation timeout means that as long as forward progress is being made,
no sequence of operations will fail.
If timeout == 0, operations will run indefinitely. (Operating
system timeouts may still apply.)
public long timeoutNanos()
timeoutNanos in class Timeout0 for no timeout.public boolean hasDeadline()
hasDeadline in class Timeoutpublic long deadlineNanoTime()
deadlineNanoTime in class Timeoutpublic Timeout deadlineNanoTime(long deadlineNanoTime)
deadlineNanoTime in class TimeoutdeadlineNanoTime - longpublic Timeout clearTimeout()
clearTimeout in class Timeoutpublic Timeout clearDeadline()
clearDeadline in class Timeoutpublic void throwIfReached()
throws IOException
TimeoutInterruptedIOException if the deadline has been reached or if the current
thread has been interrupted. This method doesn't detect timeouts; that should be implemented to
asynchronously abort an in-progress operation.throwIfReached in class TimeoutIOException - 抛出异常Copyright © 2019. All rights reserved.