| Constructor and Description |
|---|
ForwardingTimeout(Timeout delegate) |
| Modifier and Type | Method and Description |
|---|---|
Timeout |
clearDeadline()
Clears the deadline.
|
Timeout |
clearTimeout()
Clears the timeout.
|
long |
deadlineNanoTime()
Returns the nano time when the deadline will
be reached.
|
Timeout |
deadlineNanoTime(long deadlineNanoTime)
Sets the nano time when the deadline will be
reached.
|
Timeout |
delegate()
Timeout instance to which this instance is currently delegating. |
boolean |
hasDeadline()
Returns true if a deadline is enabled.
|
ForwardingTimeout |
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)
Wait at most
timeout time before aborting an operation. |
long |
timeoutNanos()
Returns the timeout in nanoseconds, or
0 for no timeout. |
deadline, waitUntilNotifiedpublic ForwardingTimeout(Timeout delegate)
public final Timeout delegate()
Timeout instance to which this instance is currently delegating.public final ForwardingTimeout setDelegate(Timeout delegate)
public Timeout timeout(long timeout, TimeUnit unit)
Timeouttimeout 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()
Timeout0 for no timeout.timeoutNanos in class Timeoutpublic boolean hasDeadline()
TimeouthasDeadline in class Timeoutpublic long deadlineNanoTime()
TimeoutdeadlineNanoTime in class Timeoutpublic Timeout deadlineNanoTime(long deadlineNanoTime)
TimeoutdeadlineNanoTime in class Timeoutpublic Timeout clearTimeout()
TimeoutclearTimeout in class Timeoutpublic Timeout clearDeadline()
TimeoutclearDeadline 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 TimeoutIOExceptionCopyright © 2017. All Rights Reserved.