|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.data.hadoop.mapreduce.JobTasklet
public class JobTasklet
Batch tasklet for executing one Hadoop job. Can be configured to not wait for the job to finish - by default the tasklet waits for the job submitted to finish.
Field Summary | |
---|---|
protected org.apache.commons.logging.Log |
log
|
Constructor Summary | |
---|---|
JobTasklet()
|
Method Summary | |
---|---|
void |
afterPropertiesSet()
|
void |
destroy()
|
RepeatStatus |
execute(StepContribution contribution,
ChunkContext chunkContext)
|
protected Collection<Job> |
findJobs()
|
boolean |
isKillJobsAtShutdown()
Indicates whether the configured jobs should be 'killed' when the application shuts down or not. |
boolean |
isVerbose()
Indicates whether the job execution is verbose (the default) or not. |
boolean |
isWaitForCompletion()
Indicates whether the 'runner' should wait for the job to complete (default). |
void |
setBeanFactory(BeanFactory beanFactory)
|
void |
setExecutor(Executor executor)
Sets the TaskExecutor used for executing the Hadoop job. |
void |
setJob(Job job)
Sets the job to execute. |
void |
setJobNames(String... jobName)
Sets the jobs to execute by (bean) name. |
void |
setJobs(Collection<Job> jobs)
Sets the jobs to execute. |
void |
setKillJobAtShutdown(boolean killJobsAtShutdown)
Indicates whether the configured jobs should be 'killed' when the application shuts down (default) or not. |
void |
setVerbose(boolean verbose)
Indicates whether the job execution is verbose (the default) or not. |
void |
setWaitForCompletion(boolean waitForJob)
Indicates whether the 'runner' should wait for the job to complete (default) after submission or not. |
protected Collection<Job> |
startJobs()
|
protected Collection<Job> |
startJobs(org.springframework.data.hadoop.mapreduce.JobExecutor.JobListener listener)
|
protected Collection<Job> |
stopJobs()
Stops running job. |
protected Collection<Job> |
stopJobs(org.springframework.data.hadoop.mapreduce.JobExecutor.JobListener listener)
Stops running job. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected org.apache.commons.logging.Log log
Constructor Detail |
---|
public JobTasklet()
Method Detail |
---|
public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) throws Exception
execute
in interface Tasklet
Exception
public void afterPropertiesSet() throws Exception
afterPropertiesSet
in interface InitializingBean
Exception
public void destroy() throws Exception
destroy
in interface DisposableBean
Exception
protected Collection<Job> stopJobs()
Exception
protected Collection<Job> stopJobs(org.springframework.data.hadoop.mapreduce.JobExecutor.JobListener listener)
listener
- job listener
Exception
protected Collection<Job> startJobs()
protected Collection<Job> startJobs(org.springframework.data.hadoop.mapreduce.JobExecutor.JobListener listener)
protected Collection<Job> findJobs()
public void setJob(Job job)
job
- The job to execute.public void setJobs(Collection<Job> jobs)
jobs
- The job to execute.public void setJobNames(String... jobName)
jobName
- The job to execute.public boolean isWaitForCompletion()
public void setWaitForCompletion(boolean waitForJob)
waitForJob
- whether to wait for the job to complete or not.public boolean isVerbose()
public void setVerbose(boolean verbose)
verbose
- whether the job execution is verbose or not.public void setBeanFactory(BeanFactory beanFactory) throws BeansException
setBeanFactory
in interface BeanFactoryAware
BeansException
public void setExecutor(Executor executor)
SyncTaskExecutor
is used, meaning the calling thread is used.
While this replicates the Hadoop behavior, it prevents running jobs from being killed if the application shuts down.
For a fine-tuned control, a dedicated Executor
is recommended.
executor
- the task executor to use execute the Hadoop job.public boolean isKillJobsAtShutdown()
public void setKillJobAtShutdown(boolean killJobsAtShutdown)
setWaitForCompletion(boolean)
is true, this flag is considered to be true as otherwise
the application cannot shut down (since it has to keep waiting for the job).
killJobsAtShutdown
- whether or not to kill configured jobs when the application shuts down
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |