Skip to content

Commit 2514346

Browse files
committed
Deprecate JobOperator#start(String, Properties)
This commit deprecates JobOperator#start(String, Properties) in favor of an overloaded method that uses domain types Job and JobParameters.
1 parent b11c4b0 commit 2514346

File tree

1 file changed

+24
-0
lines changed
  • spring-batch-core/src/main/java/org/springframework/batch/core/launch

1 file changed

+24
-0
lines changed

spring-batch-core/src/main/java/org/springframework/batch/core/launch/JobOperator.java

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,36 @@ public interface JobOperator extends JobLauncher {
5959
* parameters already exists
6060
* @throws JobParametersInvalidException thrown if any of the job parameters are
6161
* invalid.
62+
* @deprecated since 6.0 in favor of {@link #start(Job, JobParameters)}. Scheduled for
63+
* removal in 6.2 or later.
6264
*/
65+
@Deprecated(since = "6.0", forRemoval = true)
6366
default Long start(String jobName, Properties parameters)
6467
throws NoSuchJobException, JobInstanceAlreadyExistsException, JobParametersInvalidException {
6568
throw new UnsupportedOperationException();
6669
}
6770

71+
/**
72+
* Start a new instance of a job with the specified parameters.
73+
* @param job the {@link Job} to start
74+
* @param jobParameters the {@link JobParameters} to start the job with
75+
* @return the {@link JobExecution} that was started
76+
* @throws NoSuchJobException if the given {@link Job} is not registered
77+
* @throws JobParametersInvalidException thrown if any of the job parameters are
78+
* @throws JobExecutionAlreadyRunningException if the JobInstance identified by the
79+
* properties already has an execution running. invalid.
80+
* @throws JobRestartException if the execution would be a re-start, but a re-start is
81+
* either not allowed or not needed.
82+
* @throws JobInstanceAlreadyCompleteException if the job has been run before with the
83+
* same parameters and completed successfully
84+
* @throws IllegalArgumentException if the job or job parameters are null.
85+
*/
86+
default JobExecution start(Job job, JobParameters jobParameters)
87+
throws NoSuchJobException, JobInstanceAlreadyCompleteException, JobExecutionAlreadyRunningException,
88+
JobRestartException, JobParametersInvalidException {
89+
return run(job, jobParameters);
90+
}
91+
6892
/**
6993
* Restart a failed or stopped {@link JobExecution}. Fails with an exception if the id
7094
* provided does not exist or corresponds to a {@link JobInstance} that in normal

0 commit comments

Comments
 (0)