[Improve](Job)Return directly when the job status does not need to change (#31028)

This commit is contained in:
Calvin Kirs
2024-02-16 14:34:19 +08:00
committed by yiguolei
parent 0d4b8386a2
commit 37d64389b9

View File

@ -244,11 +244,11 @@ public abstract class AbstractJob<T extends AbstractTask, C> implements Job<T, C
if (null == newJobStatus) {
throw new IllegalArgumentException("jobStatus cannot be null");
}
if (jobStatus == newJobStatus) {
return;
}
String errorMsg = String.format("Can't update job %s status to the %s status",
jobStatus.name(), newJobStatus.name());
if (jobStatus == newJobStatus) {
throw new IllegalArgumentException(errorMsg);
}
if (newJobStatus.equals(JobStatus.RUNNING) && !jobStatus.equals(JobStatus.PAUSED)) {
throw new IllegalArgumentException(errorMsg);
}