|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.jmonks.batch.framework.controller.pool.AbstractPoolJobLoader
AbstractPoolJobLoader implements all the management and monitoring methods
and abstracts the user from the job pool. This allows the loader implementers
to concentrate on the business logic. Following is an example, how to write
your own loader by using AbstractPoolJobLoader.
public class MyPoolJobLoader extends AbstractPoolJobLoader
{
public ErrorCode loadPool(JobContext jobContext)
{
for(int i=0;i<100;i++)
{
loadJobData(new Integer(i));
if(super.stopLoading())
{
doCleanup();
super.loaderStatus=ProcessorStatus.STOPPED;
break;
}
}
loadJobData(null);
return ErrorCode.JOB_COMPLETED_SUCCESSFULLY;
}
}
| Field Summary | |
protected ProcessorStatus |
loaderStatus
Holds the status of the loader. |
| Constructor Summary | |
AbstractPoolJobLoader()
|
|
| Method Summary | |
java.lang.Object |
getLoaderState()
Returns the processing state of the loader. |
ProcessorStatus |
getLoaderStatus()
Returns the status of the loader. |
abstract long |
getTotalJobDataCount()
Returns the number of job data objects that this loader is going to load. |
protected boolean |
loadJobData(java.lang.Object jobData)
Loads the given job data into the job pool.This method is for the final loaders to load the job data into the pool. |
abstract ErrorCode |
loadPool(JobContext jobContext)
Load the job data into the pool that needs to be processed by job processor(s). |
ErrorCode |
loadPool(JobContext jobContext,
JobPool pool)
Abstracts the job pool details from the final loader by defining other set of methods for the final loader and implements the management and monitoring related methods. |
boolean |
resume()
Resumes the loading of the jobs. |
boolean |
stop()
Stops the loading of the jobs into the pool. |
protected boolean |
stopLoading()
Tells whether the loading of the jobs needs to be stopped or not. |
boolean |
suspend()
Suspends loading of the jobs into the pool. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected ProcessorStatus loaderStatus
| Constructor Detail |
public AbstractPoolJobLoader()
| Method Detail |
public final ErrorCode loadPool(JobContext jobContext,
JobPool pool)
loadPool in interface PoolJobLoaderjobContext - Context of the job being run.pool - Job Pool reference.
protected final boolean loadJobData(java.lang.Object jobData)
jobData - Job data object that needs to be processed.
protected final boolean stopLoading()
public boolean resume()
resume in interface PoolJobLoaderpublic boolean stop()
stop in interface PoolJobLoaderpublic boolean suspend()
suspend in interface PoolJobLoaderpublic ProcessorStatus getLoaderStatus()
getLoaderStatus in interface PoolJobLoaderpublic java.lang.Object getLoaderState()
getLoaderState in interface PoolJobLoaderpublic abstract ErrorCode loadPool(JobContext jobContext)
Load the job data into the pool that needs to be processed by job processor(s). Implementers can take the help of the loadJobData(Object) method defined here to load the jobs into the pool. Please see the example given in class description to how to implement the loadPool method.
jobContext - Context of the job being run.
public abstract long getTotalJobDataCount()
getTotalJobDataCount in interface PoolJobLoader
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||