Package org.springframework.batch.core
Enum Class BatchStatus
- All Implemented Interfaces:
Serializable
,Comparable<BatchStatus>
,Constable
Enumeration representing the status of an Execution.
- Author:
- Lucas Ward, Dave Syer, Michael Minella, Mahmoud Ben Hassine
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum Constants -
Method Summary
Modifier and TypeMethodDescriptionboolean
isGreaterThan
(BatchStatus other) boolean
isLessThan
(BatchStatus other) boolean
isLessThanOrEqualTo
(BatchStatus other) boolean
Convenience method to decide if a status indicates work is in progress.boolean
Convenience method to decide if a status indicates execution was unsuccessful.static BatchStatus
Find a BatchStatus that matches the beginning of the given value.static BatchStatus
max
(BatchStatus status1, BatchStatus status2) upgradeTo
(BatchStatus other) Method used to move status values through their logical progression, and override less severe failures with more severe ones.static BatchStatus
Returns the enum constant of this class with the specified name.static BatchStatus[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
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 byupgradeTo(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
-
STARTED
-
STOPPING
-
STOPPED
-
FAILED
-
ABANDONED
-
UNKNOWN
-
-
Method Details
-
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
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 nameNullPointerException
- if the argument is null
-
max
-
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
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
- Parameters:
other
- a status value to compare- Returns:
- true if this is greater than other
-
isLessThan
- Parameters:
other
- a status value to compare- Returns:
- true if this is less than other
-
isLessThanOrEqualTo
- Parameters:
other
- a status value to compare- Returns:
- true if this is less than other
-
match
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
-