Java Reference
In-Depth Information
Listing 5-10. HelloWorld Job Output from Both Runs
Run 1 executed with the command java -jar metadata-0.0.1-SNAPSHOT.jar name=Michael
2010-12-17 22:42:50,613 DEBUG
org.springframework.batch.core.launch.support.CommandLineJobRunner.main()
[org.springframework.batch.core.scope.context.StepContextRepeatCallback] - <Chunk execution
starting: queue size=0>
Hello, Michael!
2010-12-17 22:42:50,619 DEBUG
org.springframework.batch.core.launch.support.CommandLineJobRunner.main()
[org.springframework.batch.core.step.tasklet.TaskletStep] - <Applying contribution:
[StepContribution: read=0, written=0, filtered=0, readSkips=0, writeSkips=0, processSkips=0,
exitStatus=EXECUTING]>
Run 2 executed with the command java -jar metadata-0.0.1-SNAPSHOT.jar name=John
2010-12-17 22:44:49,960 DEBUG
org.springframework.batch.core.launch.support.CommandLineJobRunner.main()
[org.springframework.batch.core.scope.context.StepContextRepeatCallback] - <Chunk execution
starting: queue size=0>
And then we have John!
2010-12-17 22:44:49,965 DEBUG
org.springframework.batch.core.launch.support.CommandLineJobRunner.main()
[org.springframework.batch.core.step.tasklet.TaskletStep] - <Applying contribution:
[StepContribution: read=0, written=0, filtered=0, readSkips=0, writeSkips=0, processSkips=0,
exitStatus=EXECUTING]>
This section looked at how to access data in the job repository via the JobExplorer. You use APIs like
the JobExplorer to access the data to use it in a safe way. Although it isn't considered good practice to
manipulate the job repository directly, that doesn't mean the data it maintains is hands-off. In fact, you
can control what happens in your jobs programmatically by manipulating the job repository. You do this
using the JobOperator.
The JobOperator
The JobOperator is very similar to the JobExplorer when you look at the method names. However,
whereas the JobExplorer provides a read-only look into the data in the job repository, the JobOperator
exposes only as much as required to take action on it. The
org.springframework.batch.core.launch. JobOperator interface lets you execute basic administrative
tasks programmatically in a job.
The JobOperator's interface consists of 11 methods, which are outlined in Table 5-2.
 
 
Search WWH ::




Custom Search