-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Open
Labels
status: waiting-for-triageIssues that we did not analyse yetIssues that we did not analyse yettype: bug
Description
This is a breaking behaviour change without any benefit imho. While this behaviour has been documented in the method's Javadoc, I don't see the reason behind it: Counting the number of invocations for a job that has never run should return 0, not throw an exception.
This change makes the JobInstanceDao/JobRepository classes more cumbersome to use.
With Batch 5:
int count = jobExplorer.getJobInstanceCount("myJob");
// do stuff with count, `0` is a possibility
// or in tests
assertThat(jobExplorer.getJobInstanceCount("myJob")).isZero();
// run job, then assert again
assertThat(jobExplorer.getJobInstanceCount("myJob")).isOne();With Batch 6:
int count;
try {
count = jobExplorer.getJobInstanceCount("myJob");
} catch (NoSuchJobException _) {
count = 0;
}
// or in tests
assertThatExceptionOfType(NoSuchJobException.class)
.isThrownBy(() -> jobExplorer.getJobInstanceCount("myJob"));
// run job, then assert again
assertThat(jobExplorer.getJobInstanceCount("myJob")).isOne();Please consider reverting this change.
quaff and banseok1216
Metadata
Metadata
Assignees
Labels
status: waiting-for-triageIssues that we did not analyse yetIssues that we did not analyse yettype: bug