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.

@FunctionalInterface public interface HttpCallCancellation
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 Type
    Method
    Description
    default boolean
    Returns whether this cancellation has been triggered.
    onCancel(Runnable callback)
    Registers a cancellation callback and returns a handle to unregister it.
  • Method Details

    • onCancel

      AutoCloseable onCancel(Runnable callback)
      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