Constraints. with Max Task Retry Count(Integer maxTaskRetryCount) 方法
Set note that this value specifically controls the number of retries for the task executable due to a nonzero exit code. The Batch service will try the task once, and may then retry up to this limit. For example, if the maximum retry count is 3, Batch tries the task up to 4 times (one initial try and 3 retries). If the maximum retry count is 0, the Batch service does not retry the task after the first attempt. If the maximum retry count is -1, the Batch service retries the task without limit.
public TaskConstraints withMaxTaskRetryCount(Integer maxTaskRetryCount)
the maxTaskRetryCount value to set
the TaskConstraints object itself.