org.jmonks.batch.framework.controller.pool
Interface JobPool

All Known Implementing Classes:
CollectionJobPool

public interface JobPool

JobPool pools all the job data being loaded by the loader and serves this data when job processors requests for the processing. This interface enables the loader, processor and controller to interact with the pool implementation.

Since:
1.0
Version:
1.0
Author:
Suresh Pragada

Method Summary
 void cleanup()
          Controller calls this method after job processing has been done.
 long getLoadedJobDataCount()
          Returns the number of job data objects being loaded into the pool.
 java.lang.Object getNextJobData()
          Gets the next available job data(piece of information) to be processed.
 void initialize(JobContext jobContext)
          Controller calls this method to initialize the job pool.
 boolean loadJobData(java.lang.Object jobData)
          Job Loader will use this API to load the job data into the pool.
 

Method Detail

initialize

public void initialize(JobContext jobContext)
Controller calls this method to initialize the job pool. This will be called before pool reference is being passed to the job loader and job processor. All the configuration defined for the job pool can be retrieved using job context reference.

Parameters:
jobContext - Context of the job being run.

getNextJobData

public java.lang.Object getNextJobData()
Gets the next available job data(piece of information) to be processed. If it is not available, it will be waited until it gets the next job data. If loader is done with loading the jobs, it returns null. At this time, processor should quit its processing.

Returns:
Returns the next available job data to be process, null if no job data is available.

loadJobData

public boolean loadJobData(java.lang.Object jobData)
Job Loader will use this API to load the job data into the pool. If job loader is done with the loading all the data to be processed, it should load null indicating that loading of all the job data has been done.

Parameters:
jobData - Job data needs to be processed.

cleanup

public void cleanup()
Controller calls this method after job processing has been done.


getLoadedJobDataCount

public long getLoadedJobDataCount()
Returns the number of job data objects being loaded into the pool.

Returns:
Returns the number of job data objects being loaded into the pool.