Package org.aoju.bus.core.io.timout
Class AssignTimeout
java.lang.Object
org.aoju.bus.core.io.timout.Timeout
org.aoju.bus.core.io.timout.AssignTimeout
将调用转发给另一个调用的
Timeout.- Since:
- Java 17+
- Author:
- Kimi Liu
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlongdeadlineNanoTime(long deadlineNanoTime) final Timeoutdelegate()booleanfinal AssignTimeoutsetDelegate(Timeout delegate) voidThrows anInterruptedIOExceptionif the deadline has been reached or if the current thread has been interrupted.longMethods inherited from class org.aoju.bus.core.io.timout.Timeout
deadline, waitUntilNotified
-
Constructor Details
-
AssignTimeout
-
-
Method Details
-
delegate
-
setDelegate
-
timeout
- Overrides:
timeoutin classTimeout- Parameters:
timeout- longunit- TimeUnit- Returns:
- timeout
Wait at most
timeouttime 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()- Overrides:
timeoutNanosin classTimeout- Returns:
- the timeout in nanoseconds, or
0for no timeout.
-
hasDeadline
public boolean hasDeadline()- Overrides:
hasDeadlinein classTimeout- Returns:
- hasDeadline true if a deadline is enabled.
-
deadlineNanoTime
public long deadlineNanoTime()- Overrides:
deadlineNanoTimein classTimeout- Returns:
- deadlineNanoTime Returns the nano time when the deadline will be reached.
-
deadlineNanoTime
- Overrides:
deadlineNanoTimein classTimeout- Parameters:
deadlineNanoTime- long- Returns:
- 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.
-
clearTimeout
- Overrides:
clearTimeoutin classTimeout- Returns:
- this Clears the timeout. Operating system timeouts may still apply.
-
clearDeadline
- Overrides:
clearDeadlinein classTimeout- Returns:
- this Clears the deadline.
-
throwIfReached
Description copied from class:TimeoutThrows anInterruptedIOExceptionif 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:
throwIfReachedin classTimeout- Throws:
IOException- 抛出异常
-