WebSphere Application Server & Liberty

WebSphere Application Server & Liberty

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only

JSR-352 (Java Batch) Post #47: Job Parameters when Restarting a Job

By David Follis posted Wed June 19, 2019 07:29 AM

  
This post is part of a series delving into the details of the JSR-352 (Java Batch) specification. Each post examines a very specific part of the specification and looks at how it works and how you might use it in a real batch application.

To start at the beginning, follow the link to the first post.

The next post in the series is here.

This series is also available as a podcast on iTunesGoogle PlayStitcher, or use the link to the RSS feed
-----

The restart method on the JobOperator interface allows you to provide a Properties object containing restart parameters.  This is equivalent to the Properties object of job parameters that can be supplied when a job is started for the first time.

The batch specification says that job parameters are NOT remembered from one execution to the next.  That means that if you specified parameters when you started the job the first time, you need to decide if you want to specify those same (or different) parameters when you restart the job when it fails (or, to be optimistic, if it fails). 

Whether you specify different values for the parameters on a restart than you did when you initially started the job depends, of course, on what those parameters do in the JSL.  The parameters might point to files that need to be processed and you still need to process those same files. 

On the other hand, it could be that the job failed because of a problem with some of those files and you have new, corrected, files somewhere else and the job restart needs to point there instead. 

There is one thing you cannot change across a restart.  If you have a partitioned step and coded the partition plan right in the JSL (meaning no PartitionMapper is involved), then the number of partitions must be the same.  If the value used for the number of partitions comes from a job parameter, then you have to specify the same value on the restart as you did on the initial start of the job.

This post is shorter than most of them because this topic is really pretty simple and straight forward.  I feel a bit guilty.  Maybe I will just make it look longer and see if anybody notices.  Obviously our song is “Killing Time” by Triumph.

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.  Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.  Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.  Excepteur sint occaecat cupidatat non provident, sunt in culpa qui official deserunt mollit anim id est laborum.

And that about wraps it up for this topic.



0 comments
10 views

Permalink