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 batch job has successfully completed its execution.
    • STARTING

      public static final BatchStatus STARTING
      Status of a batch job prior to its execution.
    • STARTED

      public static final BatchStatus STARTED
      Status of a batch job that is running.
    • STOPPING

      public static final BatchStatus STOPPING
      Status of batch job waiting for a step to complete before stopping the batch job.
    • STOPPED

      public static final BatchStatus STOPPED
      Status of a batch job that has been stopped by request.
    • FAILED

      public static final BatchStatus FAILED
      Status of a batch job that has failed during its execution.
    • ABANDONED

      public static final BatchStatus ABANDONED
      Status of a batch job that did not stop properly and can not be restarted.
    • UNKNOWN

      public static final BatchStatus UNKNOWN
      Status of a batch job that is in an uncertain state.
  • 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)
      Convenience method to return the higher value status of the statuses passed to the method.
      Parameters:
      status1 - The first status to check.
      status2 - The second status to check.
      Returns:
      The higher value status of the two statuses.
    • isRunning

      public boolean isRunning()
      Convenience method to decide if a status indicates that work is in progress.
      Returns:
      true if the status is STARTING, STARTED, STOPPING
    • 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 which to compare.
      Returns:
      either this or the other status, depending on their priority.
    • isGreaterThan

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

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

      public boolean isLessThanOrEqualTo(BatchStatus other)
      Parameters:
      other - A status value to which 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 it has low precedence.
      Parameters:
      value - A string representing a status.
      Returns:
      a {BatchStatus} object.