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, waitUntilNotified
public 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)
Timeout
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()
Timeout
0
for no timeout.timeoutNanos
in class Timeout
public boolean hasDeadline()
Timeout
hasDeadline
in class Timeout
public long deadlineNanoTime()
Timeout
deadlineNanoTime
in class Timeout
public Timeout deadlineNanoTime(long deadlineNanoTime)
Timeout
deadlineNanoTime
in class Timeout
public Timeout clearTimeout()
Timeout
clearTimeout
in class Timeout
public Timeout clearDeadline()
Timeout
clearDeadline
in class Timeout
public void throwIfReached() throws IOException
Timeout
InterruptedIOException
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 Timeout
IOException
Copyright © 2017. All rights reserved.