Nov 6th, 2007, 10:34 AM
Access to job statistics from launcher
A have written a simple implementation of a job launcher which reads a SimpleJobLauncher from the Spring Batch config file, and invokes the run() method.
What I would like to do is to print the job statistics after the job has been run. The class SimpleJobExecutionFacade has a method getStatistics(), and is a member varaible of SimpleJobLauncher, however there is no getter i.e. simpleJobLauncher.getSimpleJobExecutionFacade().ge tStatistics() .
Would this be good idea? Or is there another way of getting statistics?
Nov 7th, 2007, 09:41 AM
Isn't SimpleJobLauncher a StatisticsProvider? If it wasn't then it certainly is now. You can also get updates by listening for RepeatOperationsApplicationEvents. Or by looking in the StepContext (using StepContextAware or StepSynchronizationManager).
By the way, the nightly snapshots now have a fix for BATCH-159 which removes the facade as a public API altogether.