|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jmonks.batch.framework.JobController org.jmonks.batch.framework.controller.pool.PoolJobController
PoolJobController provides the job architecture based on the pool concept,
where a loader is load all the information to be processed into the pool and
processors(>=1) retrieves the information from pool and process them.
It provides the abstract loader and processor classes to be overriden by job
implementation and comes with different implementation of pools.
To write any job using this controller, developer needs to write a loader class
extends AbstractPoolJobLoader, which loads the data needs to be processed into
the pool and write a processor class extending the AbstractPoolJobProcessor,
which process the data from the pool. Once implementation is done,
this job should be configured either using the XML configuration or DB configuration.
XML Configuration is as follows
<job-config job-name="process_file_abc"> <job-controller controller-class-name="org.jmonks.batch.framework.controller.pool.PoolJobController"> <pool-job-loader pool-job-loader-class-name="com.mycompany.batch.processfileabc.AbcJobLoader"> <property key="pool-job-loader-config1">pool-job-loader-value1</property> </pool-job-loader> <pool-job-processor pool-job-processor-class-name="com.mycompany.batch.processfileabc.AbcJobProcessor" thread-count="5"> <property key="pool-job-processor-config1">pool-job-processor-value1</property> </pool-job-processor> <job-pool job-pool-class-name="org.jmonks.batch.framework.controller.pool.CollectionJobPool"> <property key="pool-size">50000</property> </job-pool> <property key="pool-controller-config1">pool-controller-value1</property> </job-controller> <job-logging-config> <logging-property-file>com.mycompany.batch.processfileabc.Logging</logging-property-file> </job-logging-config> </job-config>
TableName.ColumnName | Value |
job_config.job_name | process_file_abc |
job_config.job_status | 1 |
job_config.job_controller_class_name | org.jmonks.batch.framework.controller.pool.PoolJobController |
job_config.job_controller_props | pool-controller-config1=pool-controller-value1:pool-controller-config1=poo2-controller-value2 |
pool_job_controller_config.job_name | process_file_abc |
pool_job_controller_config.pool_job_loader_class_name | com.mycompany.batch.processfileabc.AbcJobLoader |
pool_job_controller_config.pool_job_loader_props | pool-job-loader-key1=loader-value1 |
pool_job_controller_config.pool_job_processor_class_name | com.mycompany.batch.processfileabc.AbcJobProcessor |
pool_job_controller_config.pool_job_processor_props | pool-job-processor-key1=processor-value1 |
pool_job_controller_config.pool_job_processor_thread_cnt | 5 |
pool_job_controller_config.job_pool_class_name | org.jmonks.batch.framework.controller.pool.CollectionJobPool |
pool_job_controller_config.job_pool_props | job-pool-size=5000 |
Field Summary |
Fields inherited from class org.jmonks.batch.framework.JobController |
jobContext |
Constructor Summary | |
PoolJobController()
Constructor enables the instantiation of the pool job controller instance. |
Method Summary | |
long |
getExpectedRecordsCount()
Returns the total number of records this job going to process. |
JobStatistics |
getJobStatistics()
Returns the statistics of this job. |
long |
getProcessedRecordsCount()
Number of records got processed so far. |
java.lang.String[] |
getProcessorIDList()
Returns the IDs assigned to all the processors, loader as a string array. |
ProcessorState |
getProcessorState(java.lang.String processorID)
Returns the current state of the processor identified by the given processor ID as the ProcessorState object. |
ProcessorStatus |
getProcessorStatus(java.lang.String processorID)
Returns the status of the processor identified by the given processor ID. |
ErrorCode |
process()
Executes the job by creating the pool, loader and processor(s) based on the configuration and have them work accordingly to process the job. |
boolean |
resume(java.lang.String processorID)
Resumes the processor identified by given processor ID. |
boolean |
stop(java.lang.String processorID)
Stops the processor identified by the given processor ID. |
boolean |
suspend(java.lang.String processorID)
Suspends the processor identified by the given processor ID. |
Methods inherited from class org.jmonks.batch.framework.JobController |
changeLogLevel, createJobController, getLogLevel |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public PoolJobController()
Method Detail |
public ErrorCode process()
Executes the job by creating the pool, loader and processor(s) based on the configuration and have them work accordingly to process the job.
process
in class JobController
public long getExpectedRecordsCount()
public long getProcessedRecordsCount()
public java.lang.String[] getProcessorIDList()
public ProcessorState getProcessorState(java.lang.String processorID)
processorID
- processor ID identifies the processor or loader.
public ProcessorStatus getProcessorStatus(java.lang.String processorID)
processorID
- ID assigned to each processor.
public boolean stop(java.lang.String processorID)
processorID
- ID assigned to each processor.
public boolean suspend(java.lang.String processorID)
processorID
- ID assigned to each processor.
public boolean resume(java.lang.String processorID)
processorID
- ID assigned to each processor.
public JobStatistics getJobStatistics()
JobController
getJobStatistics
in class JobController
org.jmonks.batch.framework.controller.JobController#getJobStatistics()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |