Enum Class BatchStatus

java.lang.Object
java.lang.Enum<BatchStatus>
org.springframework.batch.core.BatchStatus
All Implemented Interfaces:
Serializable, Comparable<BatchStatus>, Constable

public enum BatchStatus extends Enum<BatchStatus>
Enumeration representing the status of an Execution.
Author:
Lucas Ward, Dave Syer, Michael Minella, Mahmoud Ben Hassine
  • Enum Constant Details

    • COMPLETED

      public static final BatchStatus COMPLETED
      The order of the status values is significant because it can be used to aggregate a set of status values - the result should be the maximum value. Since COMPLETED is first in the order, only if all elements of an execution are COMPLETED will the aggregate status be COMPLETED. A running execution is expected to move from STARTING to STARTED to COMPLETED (through the order defined by upgradeTo(BatchStatus)). Higher values than STARTED signify more serious failure. ABANDONED is used for steps that have finished processing, but were not successful, and where they should be skipped on a restart (so FAILED is the wrong status).
    • STARTING

      public static final BatchStatus STARTING
    • STARTED

      public static final BatchStatus STARTED
    • STOPPING

      public static final BatchStatus STOPPING
    • STOPPED

      public static final BatchStatus STOPPED
    • FAILED

      public static final BatchStatus FAILED
    • ABANDONED

      public static final BatchStatus ABANDONED
    • UNKNOWN

      public static final BatchStatus UNKNOWN
  • Method Details

    • values

      public static BatchStatus[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static BatchStatus valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (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 class has no constant with the specified name
      NullPointerException - if the argument is null
    • max

      public static BatchStatus max(BatchStatus status1, BatchStatus status2)
    • isRunning

      public boolean isRunning()
      Convenience method to decide if a status indicates work is in progress.
      Returns:
      true if the status is STARTING, STARTED
    • isUnsuccessful

      public boolean isUnsuccessful()
      Convenience method to decide if a status indicates execution was unsuccessful.
      Returns:
      true if the status is FAILED or greater
    • upgradeTo

      public BatchStatus upgradeTo(BatchStatus other)
      Method used to move status values through their logical progression, and override less severe failures with more severe ones. This value is compared with the parameter and the one that has higher priority is returned. If both are STARTED or less than the value returned is the largest in the sequence STARTING, STARTED, COMPLETED. Otherwise the value returned is the maximum of the two.
      Parameters:
      other - another status to compare to
      Returns:
      either this or the other status depending on their priority
    • isGreaterThan

      public boolean isGreaterThan(BatchStatus other)
      Parameters:
      other - a status value to compare
      Returns:
      true if this is greater than other
    • isLessThan

      public boolean isLessThan(BatchStatus other)
      Parameters:
      other - a status value to compare
      Returns:
      true if this is less than other
    • isLessThanOrEqualTo

      public boolean isLessThanOrEqualTo(BatchStatus other)
      Parameters:
      other - a status value to compare
      Returns:
      true if this is less than other
    • match

      public static BatchStatus match(String value)
      Find a BatchStatus that matches the beginning of the given value. If no match is found, return COMPLETED as the default because has is low precedence.
      Parameters:
      value - a string representing a status
      Returns:
      a BatchStatus