Interface CancellationScope

    • Method Detail

      • isDetached

        boolean isDetached()
        When set to false parent thread cancellation causes this one to get cancelled 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 CancellationException 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 cancelled 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 cancelled. It contains reason value or null if none was provided.
      • throwCancelled

        static void throwCancelled()
                            throws java.util.concurrent.CancellationException
        Throws CancellationException if scope is cancelled. Noop if not cancelled.
        Throws:
        java.util.concurrent.CancellationException