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

All Known Implementing Classes:
AbstractPoolJobProcessor

public interface PoolJobProcessor

PoolJobProcessor gets the job data to be processed from the job pool and processes it. Along with the processing methods, it exposes some methods used by management and monitoring clients.

      public class MyPoolJobProcessor implements PoolJobProcessor
      {
          public ErrorCode processPool(JobContext jobContext, JobPool pool)
          {
              Object jobData=null;
              while((jobData=pool.getNextJobData())!=null)
              {
                  // Perform the business logic on jobData
              }

              return ErrorCode.JOB_COMPLETED_SUCCESSFULLY;
          }

          // Implement all the other management and monitoring APIs.
      }
  

Since:
1.0
Version:
1.0
Author:
Suresh pragada

Method Summary
 long getProcessedJobDataCount()
          Returns the number of job data objects this particular job processor has finsihed.
 java.lang.Object getProcessorState()
          Gets the processor to be displyed or anaylyzed for the monitoring purposes.
 ProcessorStatus getProcessorStatus()
          Gets the processor status being used by the management clients.
 ErrorCode processPool(JobContext jobContext, JobPool pool)
           Process the job data available in the job pool until the job loader done loading of all the job data into the pool.
 boolean resume()
          Resumes the pool job processor.
 boolean stop()
          Stops the processor.
 boolean suspend()
          Suspends the pool job processor.
 

Method Detail

processPool

public ErrorCode processPool(JobContext jobContext,
                             JobPool pool)

Process the job data available in the job pool until the job loader done loading of all the job data into the pool. JobContext reference provides the access to many different resources in the framework. Return the final error code inditcating the status of this processor.

Parameters:
jobContext - Context the job is being run.
pool - Reference to Job Pool.
Returns:
Returns the error code.

suspend

public boolean suspend()
Suspends the pool job processor.

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

resume

public boolean resume()
Resumes the pool job processor.

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

stop

public boolean stop()
Stops the processor.

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

getProcessorState

public java.lang.Object getProcessorState()
Gets the processor to be displyed or anaylyzed for the monitoring purposes.

Returns:
Returns an object understanble/displayable by monitoring client.

getProcessorStatus

public ProcessorStatus getProcessorStatus()
Gets the processor status being used by the management clients.

Returns:
Returns the status of the job.

getProcessedJobDataCount

public long getProcessedJobDataCount()
Returns the number of job data objects this particular job processor has finsihed.

Returns:
Returns the number of job data objects processed.