org.springframework.data.hadoop.mapreduce
Class JobRunner

java.lang.Object
  extended by org.springframework.data.hadoop.mapreduce.JobRunner
All Implemented Interfaces:
DisposableBean, FactoryBean<Object>, InitializingBean

public class JobRunner
extends Object
implements FactoryBean<Object>, InitializingBean, DisposableBean

Simple runner for submitting Hadoop jobs sequentially. By default, the runner waits for the jobs to finish and returns a boolean indicating whether all the jobs succeeded or not (when there's no waiting, the status cannot be determined and null is returned).

For more control over the job execution and outcome consider querying the Jobs or using Spring Batch (see the reference documentation for more info).

Author:
Costin Leau

Constructor Summary
JobRunner()
           
 
Method Summary
 void afterPropertiesSet()
           
 void destroy()
           
 Object getObject()
           
 Class<?> getObjectType()
           
 boolean isSingleton()
           
 void setIgnoreFailures(boolean ignoreFailures)
          Indicates whether job failures are ignored (simply logged) or not (default), meaning the runner propagates the error further down the stack.
 void setJobs(Collection<Job> jobs)
          Sets the Jobs to run.
 void setRunAtStartup(boolean runAtStartup)
          Indicates whether the jobs should be submitted at startup or not.
 void setWaitForJobs(boolean waitForJobs)
          Indicates whether the runner should wait for the jobs to finish (the default) or not.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JobRunner

public JobRunner()
Method Detail

afterPropertiesSet

public void afterPropertiesSet()
                        throws Exception
Specified by:
afterPropertiesSet in interface InitializingBean
Throws:
Exception

destroy

public void destroy()
             throws Exception
Specified by:
destroy in interface DisposableBean
Throws:
Exception

getObject

public Object getObject()
                 throws Exception
Specified by:
getObject in interface FactoryBean<Object>
Throws:
Exception

getObjectType

public Class<?> getObjectType()
Specified by:
getObjectType in interface FactoryBean<Object>

isSingleton

public boolean isSingleton()
Specified by:
isSingleton in interface FactoryBean<Object>

setRunAtStartup

public void setRunAtStartup(boolean runAtStartup)
Indicates whether the jobs should be submitted at startup or not.

Parameters:
runAtStartup - The runAtStartup to set.

setWaitForJobs

public void setWaitForJobs(boolean waitForJobs)
Indicates whether the runner should wait for the jobs to finish (the default) or not.

Parameters:
waitForJobs - The waitForJobs to set.

setJobs

public void setJobs(Collection<Job> jobs)
Sets the Jobs to run.

Parameters:
jobs - The jobs to run.

setIgnoreFailures

public void setIgnoreFailures(boolean ignoreFailures)
Indicates whether job failures are ignored (simply logged) or not (default), meaning the runner propagates the error further down the stack. Note this setting applies only if the runner monitors/waits for the jobs.

Parameters:
ignoreFailures - the new ignore failures
See Also:
setWaitForJobs(boolean)