Class CancellationFlag


  • public final class CancellationFlag
    extends Object
    An invocation cancellation flag.
    Author:
    David M. Lloyd
    • Constructor Detail

      • CancellationFlag

        public CancellationFlag()
        Construct a new instance.
    • Method Detail

      • cancel

        public boolean cancel​(boolean setFlag)
        Attempt to cancel the corresponding invocation.
        Parameters:
        setFlag - true to set the Jakarta Enterprise Beans context cancellation flag (or equivalent), false otherwise
        Returns:
        true if the invocation was definitely cancelled, or false if it was not cancelled or it could not be determined if it was cancelled
      • runIfNotCancelled

        public boolean runIfNotCancelled()
        Attempt to determine whether the invocation should proceed or whether it should be cancelled. This method should only be called once per flag instance.
        Returns:
        true if the invocation should proceed, or false if it was cancelled
      • isCancelFlagSet

        public boolean isCancelFlagSet()
        Determine if the cancel flag was set.
        Returns:
        true if the flag was set, false otherwise
      • isCancelled

        public boolean isCancelled()
        Determine if the request was cancelled before it could complete.
        Returns:
        true if the request was cancelled, false otherwise