Package org.miaixz.bus.core.io.timout
Class AsyncTimeout
java.lang.Object
org.miaixz.bus.core.io.timout.Timeout
org.miaixz.bus.core.io.timout.AsyncTimeout
此超时使用后台线程在超时发生时精确地执行操作 用它来 在本地不支持超时的地方实现超时,例如对阻塞的套接字操作.
- Since:
- Java 17+
- Author:
- Kimi Liu
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal voidenter()final booleanexit()如果发生超时则返回 trueprotected IOExceptionnewTimeoutException(IOException cause) final Sinkfinal Sourceprotected voidtimedOut()Methods inherited from class org.miaixz.bus.core.io.timout.Timeout
clearDeadline, clearTimeout, deadline, deadlineNanoTime, deadlineNanoTime, hasDeadline, throwIfReached, timeout, timeoutNanos, waitUntilNotified
-
Constructor Details
-
AsyncTimeout
public AsyncTimeout()
-
-
Method Details
-
enter
public final void enter() -
exit
public final boolean exit()如果发生超时则返回 true- Returns:
- the true/false
-
timedOut
protected void timedOut() -
sink
-
source
-
newTimeoutException
-