[Batchserver-cvs] batchserver/src/org/jmonks/batch/framework/controller/pool AbstractPoolJobLoader
Brought to you by:
suresh_pragada
From: Suresh <sur...@us...> - 2006-09-20 02:43:29
|
Update of /cvsroot/batchserver/batchserver/src/org/jmonks/batch/framework/controller/pool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv3833 Modified Files: AbstractPoolJobLoader.java PoolJobLoader.java PoolJobProcessor.java Log Message: no message Index: PoolJobProcessor.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batch/framework/controller/pool/PoolJobProcessor.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** PoolJobProcessor.java 15 Sep 2006 20:06:49 -0000 1.1 --- PoolJobProcessor.java 20 Sep 2006 02:43:27 -0000 1.2 *************** *** 9,12 **** --- 9,30 ---- * processes it. Along with the processing methods, it exposes some methods used * by management and monitoring clients. + * <br> + * <pre> + * 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. + * } + * </pre> * </p> * *************** *** 20,42 **** * <p> * Process the job data available in the job pool until the job loader done loading ! * of all the job data. JobContext reference provides the access to ! * many different resources in the framework. Following is an examples shows ! * the sample implementation of processPool method. ! * <br><br> ! * <pre> ! * 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; ! * } ! * } ! * </pre> * </p> * --- 38,44 ---- * <p> * 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. * </p> * Index: AbstractPoolJobLoader.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batch/framework/controller/pool/AbstractPoolJobLoader.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** AbstractPoolJobLoader.java 15 Sep 2006 20:06:49 -0000 1.1 --- AbstractPoolJobLoader.java 20 Sep 2006 02:43:27 -0000 1.2 *************** *** 20,25 **** * <p> * AbstractPoolJobLoader implements all the management and monitoring methods ! * and abstracts the user from the job pool. This allows the loader implementation ! * to concentrate on the business logic. * </p> * --- 20,47 ---- * <p> * 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. ! * <br> ! * <pre> ! * 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; ! * } ! * } ! * </pre> * </p> * *************** *** 207,232 **** * Load the job data into the pool that needs to be processed by job processor(s). * Implementers can take the help of the <i>loadJobData(Object)</i> method defined ! * here to load the jobs into the pool. ! * <br> ! * <pre> ! * 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; ! * } ! * } ! * </pre> * </p> * --- 229,234 ---- * Load the job data into the pool that needs to be processed by job processor(s). * Implementers can take the help of the <i>loadJobData(Object)</i> method defined ! * here to load the jobs into the pool. Please see the example given in class ! * description to how to implement the <i>loadPool</i> method. * </p> * Index: PoolJobLoader.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batch/framework/controller/pool/PoolJobLoader.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** PoolJobLoader.java 15 Sep 2006 20:06:49 -0000 1.1 --- PoolJobLoader.java 20 Sep 2006 02:43:27 -0000 1.2 *************** *** 9,13 **** * 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. * </p> * --- 9,30 ---- * 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. ! * <br> ! * Example loading the 100 integer objects into the pool. ! * <pre> ! * 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. ! * } ! * </pre> * </p> * *************** *** 21,43 **** * <p> * Loads the job data that needs to be processed in to the job pool. ! * When finished loading of all the job data, loads the <i>null</i> into the pool ! * to singal the processor(s) that loading of all the jobs have been done. * Configuration defined for this loader in job configuration can be accessed * using job context reference. - * <br> - * Example loading the 100 integer objects into the pool. - * <pre> - * 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 - * } - * } - * <pre> * </p> * --- 38,45 ---- * <p> * Loads the job data that needs to be processed in to the job pool. ! * When finished loading of all the job data, load <i>null</i> 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. * </p> * |