Interface CancellationScope

    • Method Detail

      • isDetached

        boolean isDetached()
        When set to false parent thread cancellation causes this one to get canceled automatically. When set to true only call to cancel() leads to this scope cancellation.
      • cancel

        void cancel()
        Cancels the scope as well as all its children
      • cancel

        void cancel​(java.lang.String reason)
        Cancels the scope as well as all its children.
        Parameters:
        reason - human readable reason for the cancellation. Becomes message of the CanceledException thrown.
      • getCancellationReason

        java.lang.String getCancellationReason()
      • isCancelRequested

        boolean isCancelRequested()
        Is scope was asked to cancel through cancel() or by a parent scope.
        Returns:
        whether request is canceled or not.
      • getCancellationRequest

        Promise<java.lang.String> getCancellationRequest()
        Use this promise to perform cancellation of async operations.
        Returns:
        promise that becomes ready when scope is canceled. It contains reason value or null if none was provided.