| 构造器和说明 |
|---|
ForwardingTimeout(Timeout delegate) |
| 限定符和类型 | 方法和说明 |
|---|---|
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 在类中 Timeoutpublic boolean hasDeadline()
TimeouthasDeadline 在类中 Timeoutpublic long deadlineNanoTime()
TimeoutdeadlineNanoTime 在类中 Timeoutpublic Timeout deadlineNanoTime(long deadlineNanoTime)
TimeoutdeadlineNanoTime 在类中 Timeoutpublic Timeout clearTimeout()
TimeoutclearTimeout 在类中 Timeoutpublic Timeout clearDeadline()
TimeoutclearDeadline 在类中 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 在类中 TimeoutIOExceptionCopyright © 2022. All rights reserved.