|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.springframework.batch.core.launch.support.JobRegistryBackgroundJobRunner
public class JobRegistryBackgroundJobRunner
Command line launcher for registering jobs with a JobRegistry.
Normally this will be used in conjunction with an external trigger for the
jobs registered, e.g. a JMX MBean wrapper for a JobLauncher, or a
Quartz trigger.
With any launch of a batch job within Spring Batch, a Spring context
containing the Job has to be created. Using this launcher, the jobs
are all registered with a JobRegistry defined in a parent application
context. The jobs are then set up in child contexts. All dependencies of the
runner will then be satisfied by autowiring by type from the parent
application context. Default values are provided for all fields except the
JobRegistry. Therefore, if autowiring fails to set it then an
exception will be thrown.
| Field Summary | |
|---|---|
static java.lang.String |
EMBEDDED
System property key that switches the runner to "embedded" mode (returning immediately from the main method). |
static boolean |
testing
|
| Constructor Summary | |
|---|---|
JobRegistryBackgroundJobRunner(java.lang.String parentContextPath)
|
|
| Method Summary | |
|---|---|
static java.util.List<java.lang.Exception> |
getErrors()
Public getter for the startup errors encountered during parent context creation. |
static void |
main(java.lang.String... args)
Supply a list of application context locations, starting with the parent context, and followed by the children. |
void |
setRegistry(JobRegistry registry)
Public setter for the JobRegistry. |
static void |
stop()
If embedded in a JVM, call this method to terminate the main method. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String EMBEDDED
public static boolean testing
| Constructor Detail |
|---|
public JobRegistryBackgroundJobRunner(java.lang.String parentContextPath)
parentContextPath - | Method Detail |
|---|
public void setRegistry(JobRegistry registry)
JobRegistry.
registry - the registry to setpublic static java.util.List<java.lang.Exception> getErrors()
public static void main(java.lang.String... args)
throws java.lang.Exception
JobRegistry and the child contexts are expected to contain
Job definitions, each of which will be registered wit the
registry.
Example usage:
$ java -classpath ... JobRegistryBackgroundJobRunner job-registry-context.xml job1.xml job2.xml ...The child contexts are created only when needed though the
JobFactory interface (but the XML is validated on startup by
using it to create a BeanFactory which is then discarded).
The parent context is created in a separate thread, and the program will
pause for input in an infinite loop until the user hits any key.
args - the context locations to use (first one is for parent)
java.lang.Exception - if anything goes wrong with the context creationpublic static void stop()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||