Package io.github.easy4j.opencode
Interface HttpCallCancellation
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Binds a business-layer cancellation signal to a single OpenCode HTTP call.
Implementations allow callers to register a cancellation callback that will be invoked
when the underlying HTTP call should be aborted. The onCancel(Runnable) method
returns an AutoCloseable that, when closed, unregisters the callback.
- Since:
- 1.0.0
- Author:
- Loong Wan
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptiondefault booleanReturns whether this cancellation has been triggered.Registers a cancellation callback and returns a handle to unregister it.
-
Method Details
-
onCancel
Registers a cancellation callback and returns a handle to unregister it.- Parameters:
callback- the runnable to invoke when cancellation is requested- Returns:
- OpenCode SDK 返回的回调注销句柄对象
-
isCancelled
default boolean isCancelled()Returns whether this cancellation has been triggered.- Returns:
- 满足条件返回
true,否则返回false
-