Enum CompletionState

    • Enum Constant Detail

      • INCOMPLETE

        public static final CompletionState INCOMPLETE
        Indicates that the task hasn't started or is still in progress.
      • SUCCESS

        public static final CompletionState SUCCESS
        Indicates that the task completed successfully without throwing any exceptions.
      • CANCELLED

        public static final CompletionState CANCELLED
        Indicates that the task was cancelled before it completed.
      • FAILED

        public static final CompletionState FAILED
        Indicates that the task completed with an exception (excluding cancellation exceptions).
    • Method Detail

      • values

        public static CompletionState[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (CompletionState c : CompletionState.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static CompletionState valueOf​(String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        IllegalArgumentException - if this enum type has no constant with the specified name
        NullPointerException - if the argument is null
      • of

        public static CompletionState of​(Future<?> future)
        Determines the CompletionState of the given Future based on its current status.

        The method returns:

        • INCOMPLETE if the future has not completed yet (i.e., is still running or pending).
        • SUCCESS if the future completed successfully without exceptions.
        • CANCELLED if the future was cancelled before completion.
        • FAILED if the future completed exceptionally due to an error (other than cancellation).
        Parameters:
        future - the Future whose completion state is to be determined
        Returns:
        the CompletionState representing the current state of the future