Skip to content

Commit

Permalink
[Improve](Job)Return directly when the job status does not need to ch…
Browse files Browse the repository at this point in the history
…ange
  • Loading branch information
CalvinKirs committed Feb 14, 2024
1 parent 7a2c1b8 commit 262cac0
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -244,11 +244,11 @@ public void updateJobStatus(JobStatus newJobStatus) throws JobException {
if (null == newJobStatus) {
throw new IllegalArgumentException("jobStatus cannot be null");
}
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);
return;
}
String errorMsg = String.format("Can't update job %s status to the %s status",
jobStatus.name(), newJobStatus.name());
if (newJobStatus.equals(JobStatus.RUNNING) && !jobStatus.equals(JobStatus.PAUSED)) {
throw new IllegalArgumentException(errorMsg);
}
Expand Down

0 comments on commit 262cac0

Please sign in to comment.