Spring for Apache Hadoop

org.springframework.data.hadoop.mapreduce
Class JobRunner

java.lang.Object
  extended by org.springframework.data.hadoop.mapreduce.JobExecutor
      extended by org.springframework.data.hadoop.mapreduce.JobRunner
All Implemented Interfaces:
java.util.concurrent.Callable<java.lang.Void>, org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.InitializingBean

public class JobRunner
extends JobExecutor
implements java.util.concurrent.Callable<java.lang.Void>

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).

To make the runner execute at startup, use setRunAtStartup(boolean).

Author:
Costin Leau

Nested Class Summary
 
Nested classes/interfaces inherited from class org.springframework.data.hadoop.mapreduce.JobExecutor
JobExecutor.JobListener
 
Field Summary
 
Fields inherited from class org.springframework.data.hadoop.mapreduce.JobExecutor
log
 
Constructor Summary
JobRunner()
           
 
Method Summary
 void afterPropertiesSet()
           
 java.lang.Void call()
           
 void setPostAction(java.util.Collection<java.util.concurrent.Callable<?>> actions)
          Actions to be invoked after running the action.
 void setPreAction(java.util.Collection<java.util.concurrent.Callable<?>> actions)
          Actions to be invoked before running the action.
 void setRunAtStartup(boolean runAtStartup)
          Indicates whether the jobs should be submitted at startup (default) or not.
 
Methods inherited from class org.springframework.data.hadoop.mapreduce.JobExecutor
destroy, findJobs, isKillJobsAtShutdown, isVerbose, isWaitForCompletion, setBeanFactory, setExecutor, setJob, setJobNames, setJobs, setKillJobAtShutdown, setVerbose, setWaitForCompletion, startJobs, startJobs, stopJobs, stopJobs
 
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 java.lang.Exception
Specified by:
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
Overrides:
afterPropertiesSet in class JobExecutor
Throws:
java.lang.Exception

call

public java.lang.Void call()
                    throws java.lang.Exception
Specified by:
call in interface java.util.concurrent.Callable<java.lang.Void>
Throws:
java.lang.Exception

setRunAtStartup

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

Parameters:
runAtStartup - The runAtStartup to set.

setPreAction

public void setPreAction(java.util.Collection<java.util.concurrent.Callable<?>> actions)
Actions to be invoked before running the action.

Parameters:
actions -

setPostAction

public void setPostAction(java.util.Collection<java.util.concurrent.Callable<?>> actions)
Actions to be invoked after running the action.

Parameters:
actions -

Spring for Apache Hadoop