diff --git a/spring-batch-integration/src/main/java/org/springframework/batch/integration/launch/JobLaunchRequest.java b/spring-batch-integration/src/main/java/org/springframework/batch/integration/launch/JobLaunchRequest.java index 4154b70ec..ff145a9f2 100644 --- a/spring-batch-integration/src/main/java/org/springframework/batch/integration/launch/JobLaunchRequest.java +++ b/spring-batch-integration/src/main/java/org/springframework/batch/integration/launch/JobLaunchRequest.java @@ -19,8 +19,7 @@ import org.springframework.batch.core.Job; import org.springframework.batch.core.JobParameters; /** - * Encapsulation of a {@link Job} and its {@link JobParameters} forming a - * request for a job to be launched. + * Encapsulation of a {@link Job} and its {@link JobParameters} forming a request for a job to be launched. * * @author Dave Syer * @@ -28,6 +27,7 @@ import org.springframework.batch.core.JobParameters; public class JobLaunchRequest { private final Job job; + private final JobParameters jobParameters; /** @@ -54,4 +54,9 @@ public class JobLaunchRequest { return this.jobParameters; } + @Override + public String toString() { + return "JobLaunchRequest: " + job.getName() + ", parameters=" + jobParameters; + } + } diff --git a/spring-batch-integration/src/main/java/org/springframework/batch/integration/launch/JobLaunchRequestHandler.java b/spring-batch-integration/src/main/java/org/springframework/batch/integration/launch/JobLaunchRequestHandler.java index 2ea64a4c0..9562e80ad 100644 --- a/spring-batch-integration/src/main/java/org/springframework/batch/integration/launch/JobLaunchRequestHandler.java +++ b/spring-batch-integration/src/main/java/org/springframework/batch/integration/launch/JobLaunchRequestHandler.java @@ -17,6 +17,7 @@ package org.springframework.batch.integration.launch; import org.springframework.batch.core.JobExecution; +import org.springframework.batch.core.JobExecutionException; /** * Interface for handling a {@link JobLaunchRequest} and returning a {@link JobExecution}. @@ -25,6 +26,6 @@ import org.springframework.batch.core.JobExecution; */ public interface JobLaunchRequestHandler { - JobExecution launch(JobLaunchRequest request); + JobExecution launch(JobLaunchRequest request) throws JobExecutionException; } \ No newline at end of file diff --git a/spring-batch-integration/src/main/java/org/springframework/batch/integration/launch/JobLaunchingMessageHandler.java b/spring-batch-integration/src/main/java/org/springframework/batch/integration/launch/JobLaunchingMessageHandler.java index 484cd63f3..4e9f001c6 100644 --- a/spring-batch-integration/src/main/java/org/springframework/batch/integration/launch/JobLaunchingMessageHandler.java +++ b/spring-batch-integration/src/main/java/org/springframework/batch/integration/launch/JobLaunchingMessageHandler.java @@ -20,13 +20,11 @@ import org.springframework.batch.core.Job; import org.springframework.batch.core.JobExecution; import org.springframework.batch.core.JobExecutionException; import org.springframework.batch.core.JobParameters; -import org.springframework.batch.core.UnexpectedJobExecutionException; import org.springframework.batch.core.launch.JobLauncher; import org.springframework.integration.annotation.ServiceActivator; /** - * Message handler which uses strategies to convert a Message into a job and a - * set of job parameters + * Message handler which uses strategies to convert a Message into a job and a set of job parameters * @author Jonas Partner * @author Dave Syer * @@ -44,17 +42,12 @@ public class JobLaunchingMessageHandler implements JobLaunchRequestHandler { } @ServiceActivator - public JobExecution launch(JobLaunchRequest request) { + public JobExecution launch(JobLaunchRequest request) throws JobExecutionException { Job job = request.getJob(); JobParameters jobParameters = request.getJobParameters(); - try { - JobExecution execution = jobLauncher.run(job, jobParameters); - return execution; - } - catch (JobExecutionException e) { - throw new UnexpectedJobExecutionException("Exception executing job: ["+request+"]", e); - } + JobExecution execution = jobLauncher.run(job, jobParameters); + return execution; } }