Package okio
Class ForwardingTimeout
- java.lang.Object
-
- okio.Timeout
-
- okio.ForwardingTimeout
-
-
Constructor Summary
Constructors Constructor Description ForwardingTimeout(Timeout delegate)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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 anInterruptedIOException
if the deadline has been reached or if the current thread has been interrupted.Timeout
timeout(long timeout, java.util.concurrent.TimeUnit unit)
Wait at mosttimeout
time before aborting an operation.long
timeoutNanos()
Returns the timeout in nanoseconds, or0
for no timeout.-
Methods inherited from class okio.Timeout
deadline, waitUntilNotified
-
-
-
-
Constructor Detail
-
ForwardingTimeout
public ForwardingTimeout(Timeout delegate)
-
-
Method Detail
-
delegate
public final Timeout delegate()
Timeout
instance to which this instance is currently delegating.
-
setDelegate
public final ForwardingTimeout setDelegate(Timeout delegate)
-
timeout
public Timeout timeout(long timeout, java.util.concurrent.TimeUnit unit)
Description copied from class:Timeout
Wait at mosttimeout
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.)
-
timeoutNanos
public long timeoutNanos()
Description copied from class:Timeout
Returns the timeout in nanoseconds, or0
for no timeout.- Overrides:
timeoutNanos
in classTimeout
-
hasDeadline
public boolean hasDeadline()
Description copied from class:Timeout
Returns true if a deadline is enabled.- Overrides:
hasDeadline
in classTimeout
-
deadlineNanoTime
public long deadlineNanoTime()
Description copied from class:Timeout
Returns the nano time when the deadline will be reached.- Overrides:
deadlineNanoTime
in classTimeout
-
deadlineNanoTime
public Timeout deadlineNanoTime(long deadlineNanoTime)
Description copied from class:Timeout
Sets the nano time when the deadline will be reached. All operations must complete before this time. Use a deadline to set a maximum bound on the time spent on a sequence of operations.- Overrides:
deadlineNanoTime
in classTimeout
-
clearTimeout
public Timeout clearTimeout()
Description copied from class:Timeout
Clears the timeout. Operating system timeouts may still apply.- Overrides:
clearTimeout
in classTimeout
-
clearDeadline
public Timeout clearDeadline()
Description copied from class:Timeout
Clears the deadline.- Overrides:
clearDeadline
in classTimeout
-
throwIfReached
public void throwIfReached() throws java.io.IOException
Description copied from class:Timeout
Throws anInterruptedIOException
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.- Overrides:
throwIfReached
in classTimeout
- Throws:
java.io.IOException
-
-