Thread: [Batchserver-cvs] batchserver/src/org/jmonks/batchserver/framework/controller/basic BasicJobContro
Brought to you by:
suresh_pragada
From: Suresh <sur...@us...> - 2006-09-15 06:21:15
|
Update of /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/controller/basic In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv16940/framework/controller/basic Modified Files: BasicJobController.java BasicJobProcessor.java Log Message: no message Index: BasicJobProcessor.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/controller/basic/BasicJobProcessor.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** BasicJobProcessor.java 14 Sep 2006 23:04:23 -0000 1.13 --- BasicJobProcessor.java 15 Sep 2006 06:21:12 -0000 1.14 *************** *** 7,11 **** /** * <p> ! * BasicJobProcessor lets developers implement their business logic. * </p> * --- 7,12 ---- /** * <p> ! * BasicJobProcessor lets job developers to implement their business logic ! * in the process method and this method will be executed by the BasicJobController. * </p> * *************** *** 128,131 **** --- 129,143 ---- * Does the processing and return the appropriate error code. Properties * configured for this job processor can be retrieved from the JobContext. + * <br> + * <pre> + * public class MyBasicJobProcessor extends BasicJobProcessor + * { + * public ErrorCode process(JobContext jobContext) + * { + * //Perform the business logic. + * return ErrorCode.JOB_COMPLETED_SUCCESSFULLY; + * } + * } + * </pre> * </p> * Index: BasicJobController.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/controller/basic/BasicJobController.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** BasicJobController.java 14 Sep 2006 23:04:59 -0000 1.16 --- BasicJobController.java 15 Sep 2006 06:21:12 -0000 1.17 *************** *** 19,25 **** /** * <p> ! * Basic Job Controller creates the configured number of basic job processor ! * instances and have them run in a seperate thread. Once all the processors have ! * finished their processing, returns the appropriate return code. * </p> * --- 19,62 ---- /** * <p> ! * BasicJobController creates and executes the Basic Job Processor ! * class defined in job configuration. It creates the configured number ! * of instances and have each instance run in a seperate thread. ! * Once all the processors have finished their processing, returns the ! * appropriate return code. ! * </p> ! * ! * <p> ! * This controller is useful to write and execute a simple business logic ! * stands on its own. Allows the flexibility to run that code in a number ! * of instances. Following is an example configuration to configure the ! * batch job written based on BasicJobController. ! * <br><br> ! * <i>XML Configuration is as follows</i> <br><br> ! * <pre> ! * <job-config job-name="process_file_abc"> ! * <job-controller controller-class-name="org.jmonks.batchserver.framework.controller.basic.BasicJobController"> ! * <basic-job-processor basic-job-processor-class-name="com.mycompany.batch.processfileabc.AbcJobProcessor" thread-count="5"> ! * <property key="basic-job-processor-config1">basic-job-processor-value1</property> ! * </basic-job-processor> ! * <property key="basic-controller-config1">basic-controller-value1</property> ! * </job-controller> ! * <job-logging-config> ! * <logging-property-file>com.mycompany.batch.processfileabc.Logging</logging-property-file> ! * </job-logging-config> ! * </job-config> ! * </pre> ! * <br><br> ! * <i>DB Configuration is as follows</i> ! * <table border="1"> ! * <tr><td><b>TableName.ColumnName</b></td><td><b>Value</b></td></tr> ! * <tr><td>job_config.job_name</td><td>process_file_abc</td></tr> ! * <tr><td>job_config.job_status</td><td>1</td></tr> ! * <tr><td>job_config.job_controller_class_name</td><td>org.jmonks.batchserver.framework.controller.basic.BasicJobController</td></tr> ! * <tr><td>job_config.job_controller_props</td><td>basic-controller-config1=basic-controller-value1:basic-controller-config1=basic-controller-value2</td></tr> ! * <tr><td>basic_job_controller_config.job_name</td><td>process_file_abc</td></tr> ! * <tr><td>basic_job_controller_config.basic_job_processor_class_name</td><td>com.mycompany.batch.processfileabc.AbcJobProcessor</td></tr> ! * <tr><td>basic_job_controller_config.basic_job_processor_props</td><td>basic-job-processor-config1=basic-job-processor-value1</td></tr> ! * <tr><td>basic_job_controller_config.basic_job_processor_thread_cnt</td><td>1</td></tr> ! * </table> * </p> * *************** *** 354,357 **** --- 391,395 ---- this.jobStatistics.setEndTime(Calendar.getInstance().getTime()); + this.jobStatistics.setMaxMemeoryUsage(Runtime.getRuntime().totalMemory()-Runtime.getRuntime().freeMemory()); this.jobStatistics.setRecordsProcessed(this.getProcessedRecordsCount()); |