Thread: [Batchserver-cvs] batchserver/src/org/jmonks/batchserver/framework/controller/pool AbstractPoolJobLo
Brought to you by:
suresh_pragada
From: Suresh <sur...@us...> - 2006-05-17 03:06:03
|
Update of /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/controller/pool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv10093 Modified Files: AbstractPoolJobLoader.java PoolJobLoader.java Log Message: no message Index: AbstractPoolJobLoader.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/controller/pool/AbstractPoolJobLoader.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** AbstractPoolJobLoader.java 16 May 2006 22:10:50 -0000 1.5 --- AbstractPoolJobLoader.java 17 May 2006 03:05:58 -0000 1.6 *************** *** 12,15 **** --- 12,16 ---- import java.util.Map; + import org.jmonks.batchserver.framework.common.ErrorCode; import org.jmonks.batchserver.framework.management.ProcessorStatus; *************** *** 30,35 **** * Holds the status of the loader. */ ! protected ProcessorStatus loaderStatus=ProcessorStatus.INITIALIZING; ! /** * Returns the processing state of the loader. --- 31,43 ---- * Holds the status of the loader. */ ! private ProcessorStatus loaderStatus=ProcessorStatus.INSTANTIATED; ! /** ! * Holds the pool reference passed by controller. ! */ ! private JobPool pool=null; ! /** ! * Holds the current job data that will be used for the monitoring purposes. ! */ ! private Object currentJobData=null; /** * Returns the processing state of the loader. *************** *** 39,43 **** public Object getLoaderState() { ! return null; } --- 47,51 ---- public Object getLoaderState() { ! return currentJobData.toString(); } *************** *** 51,63 **** return this.loaderStatus; } ! ! public ErrorCode loadPool(JobPool pool) { ! return null; } ! public abstract ! public boolean resume() { --- 59,105 ---- return this.loaderStatus; } + /** + * Abstracts the loading of the job data into the pool by defining + * another set of methods to load into the pool and implements the + * management and monitoring related methods. + * + * @param configProps Properties defined for this loader in job configuration. + * @param pool Job Pool reference. + * + * @return Returns the final error code of loading the jobs. + */ + public final ErrorCode loadPool(Map configProps,JobPool pool) + { + this.pool=pool; + ErrorCode returnCode=ErrorCode.JOB_COMPLETED_SUCCESSFULLY; + try + { + returnCode=this.loadPool(configProps); + } + catch(Throwable exception) + { + exception.printStackTrace(); + returnCode=ErrorCode.BASIC_JOB_PROCESSOR_EXCEPTION; + } + return returnCode; + } ! /** ! * Loads the given job data into the job pool. ! * ! * @param jobData Job data object that needs to be processed. ! * ! * @return Returns true if the job data is loaded into the pool, false otherwise. ! */ ! protected final boolean loadJobData(Object jobData) { ! boolean loaded=false; ! if(jobData!=null) ! this.currentJobData=jobData; ! loaded=this.pool.loadJobData(jobData); ! return loaded; } ! public boolean resume() { *************** *** 76,91 **** /** - * Chance to grab the properties defined for this job loader in job - * configuration and do some initialization. * - * @param configProps Properties defined in job configuration as a Map. */ ! public abstract void initialize(Map configProps); ! ! /** ! * Chance to do some cleanup for the Loader implementation. ! */ ! public abstract void cleanup(); ! /** * Returns the number of job data objects that this loader is going to load. --- 118,124 ---- /** * */ ! public abstract ErrorCode loadPool(Map configProps); /** * Returns the number of job data objects that this loader is going to load. Index: PoolJobLoader.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/controller/pool/PoolJobLoader.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** PoolJobLoader.java 16 May 2006 03:15:28 -0000 1.4 --- PoolJobLoader.java 17 May 2006 03:05:58 -0000 1.5 *************** *** 15,33 **** { /** - * Chance for the loader to initialize itself with the properties defined - * in the job configuration. - * - * @param configProps Configuration defined for the loader. - */ - public void initialize(Map configProps); - /** - * Chance to do some cleanup before the job loader being shutdown. - */ - public void cleanup(); - /** * <p> ! * Loads the job data to the given 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. * <br> * Example loading the 100 integer objects into the pool. --- 15,24 ---- { /** * <p> ! * Loads the job data that needs to be processed in to the given 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 will be available ! * in configProps map. * <br> * Example loading the 100 integer objects into the pool. *************** *** 35,39 **** * public class MyLoader * { ! * public ErrorCode loadPool(JobPool pool) * { * for(int i=0;i<100;i++ --- 26,30 ---- * public class MyLoader * { ! * public ErrorCode loadPool(Map configProps, JobPool pool) * { * for(int i=0;i<100;i++ *************** *** 45,51 **** * </p> * * @param pool Job Pool reference. */ ! public ErrorCode loadPool(JobPool pool); /** * Suspends the loader. --- 36,43 ---- * </p> * + * @param configProps Properties defined for this job loader in job configuration. * @param pool Job Pool reference. */ ! public ErrorCode loadPool(Map configProps,JobPool pool); /** * Suspends the loader. |