Package org.aoju.bus.core.io.timout
Class AsyncTimeout
java.lang.Object
org.aoju.bus.core.io.timout.Timeout
org.aoju.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.aoju.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
- Parameters:
sink- 缓冲接收器- Returns:
- 新缓冲接收器
-
source
- Parameters:
source- 源- Returns:
- 新源
-
newTimeoutException
- Parameters:
cause- 异常- Returns:
- 异常信息
-