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

All Known Implementing Classes:
AbstractPoolJobLoader

public interface PoolJobLoader

PoolJobLoader loads the job data into the pool to be processed by PoolJobProcessor(s). Along with the methods to load job data into the pool, it exposes the some other methods used by the management and monitoring clients.
Example loading the 100 integer objects into the pool.

      public class MyPoolJobLoader implements PoolJobLoader
      {
          public ErrorCode loadPool(JobContext jobContext, JobPool pool)
          {
              for(int i=0;i<100;i++)
                  pool.loadJobData(new Integer(i));
              pool.loadJobData(null);

              return ErrorCode.JOB_COMPLETED_SUCCESSFULLY
          }
  
          // Implement all the other management and monitor APIs.
      }
  

Since:
1.0
Version:
1.0
Author:
Suresh Pragada

Method Summary
 java.lang.Object getLoaderState()
          Gets the loader state as object which can be understan by the monitoring client.
 ProcessorStatus getLoaderStatus()
          Gets the loader status.
 long getTotalJobDataCount()
          Gets the total records this loader is going to load.
 ErrorCode loadPool(JobContext jobContext, JobPool pool)
           Loads the job data that needs to be processed in to the job pool.
 boolean resume()
          Resumes the loader.
 boolean stop()
          Stops the loader.
 boolean suspend()
          Suspends the loader.
 

Method Detail

loadPool

public ErrorCode loadPool(JobContext jobContext,
                          JobPool pool)

Loads the job data that needs to be processed in to the job pool. When finished loading of all the job data, load null into the pool to singal the processor(s) that loading of all the jobData has been done. Configuration defined for this loader in job configuration can be accessed using job context reference.

Parameters:
jobContext - Context of the job being run.
pool - Job Pool reference.
Returns:
Retrurns the final status of the loader.

suspend

public boolean suspend()
Suspends the loader.

Returns:
Returns true if loader is suspended, false otherwise.

resume

public boolean resume()
Resumes the loader.

Returns:
Returns true if loader is resumed, false otherwise.

stop

public boolean stop()
Stops the loader.

Returns:
Returns true if loader is stopped, false otherwise.

getTotalJobDataCount

public long getTotalJobDataCount()
Gets the total records this loader is going to load.

Returns:
Returns the number of records this loader is going to load.

getLoaderState

public java.lang.Object getLoaderState()
Gets the loader state as object which can be understan by the monitoring client. Usually, this would be used for display purposes.

Returns:
Returns the displayable object representing the loader state.

getLoaderStatus

public ProcessorStatus getLoaderStatus()
Gets the loader status.

Returns:
Returns the loader status.