batchserver-cvs Mailing List for Enterprise Batch Server (Page 18)
Brought to you by:
suresh_pragada
You can subscribe to this list here.
2006 |
Jan
|
Feb
(10) |
Mar
(159) |
Apr
(5) |
May
(52) |
Jun
(70) |
Jul
|
Aug
(28) |
Sep
(256) |
Oct
(38) |
Nov
|
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(3) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Suresh <sur...@us...> - 2006-05-14 04:17:15
|
Update of /cvsroot/batchserver/batchserver/lib/log4j In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv22950 Added Files: log4j_1.2.13.jar Log Message: no message --- NEW FILE: log4j_1.2.13.jar --- (This appears to be a binary file; contents omitted.) |
From: Suresh <sur...@us...> - 2006-05-14 01:34:52
|
Update of /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/management In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv3094 Modified Files: JobManager.java JobManagerMBean.java JobMonitor.java JobMonitorMBean.java Added Files: ProcessorState.java ProcessorStatus.java Removed Files: JobStatus.java ThreadState.java Log Message: no message Index: JobMonitorMBean.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/management/JobMonitorMBean.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** JobMonitorMBean.java 25 Mar 2006 19:29:57 -0000 1.1 --- JobMonitorMBean.java 14 May 2006 01:34:49 -0000 1.2 *************** *** 4,8 **** * <p> * JobMonitorMBean interface defines the methods to instrument the job being run ! * to find out the statistics of the job and to find out all the thread states * running in the controller. This follows the JMX standard MBean paradigm to define * name of the MBean and methods instrument the job. --- 4,8 ---- * <p> * JobMonitorMBean interface defines the methods to instrument the job being run ! * to find out the statistics of the job and to find out all the processor states * running in the controller. This follows the JMX standard MBean paradigm to define * name of the MBean and methods instrument the job. *************** *** 29,43 **** /** ! * Returns the number of threads being run by this job. * ! * @return Returns the number of threads being run by this job. */ ! public String[] getThreadIDList(); /** ! * Gets the state of this thread. This returns the state in a ThreadState object. * ! * @return Returns the state of this thread. */ ! public ThreadState getThreadState(String threadID); } --- 29,44 ---- /** ! * Returns the array of IDs assigned to be processors running under this controller. * ! * @return Returns the array of IDs being assigned by each processor. */ ! public String[] getProcessorIDList(); /** ! * Gets the state of the processor identified by the given processor ID. ! * This returns the state in a ProcessorState object. * ! * @return Returns the state of the requested processor. */ ! public ProcessorState getProcessorState(String processorID); } --- NEW FILE: ProcessorStatus.java --- package org.jmonks.batchserver.framework.management; /** * <p> * ProcessorStatus defines the statuses that processors can be in the system. * </p> * * @author Suresh Pragada * @version 1.0 * @since 1.0 */ public class ProcessorStatus { /** * Status indicates that processor is instantiated. */ public static ProcessorStatus INSTANTIATED = new ProcessorStatus("INSTANTIATED"); /** * Status indicates that processor is being initialized. */ public static ProcessorStatus INITIALIZING = new ProcessorStatus("INITIALIZING"); /** * Status indicates that processor is initailized. */ public static ProcessorStatus INITIALIZED = new ProcessorStatus("INITIALIZED"); /** * Status indicates that processor is running. */ public static ProcessorStatus RUNNING = new ProcessorStatus("RUNNING"); /** * Status indictes that processor is suspended. */ public static ProcessorStatus SUSPENDED = new ProcessorStatus("SUSPENDED"); /** * Status indicates the processor is stopped. */ public static ProcessorStatus STOPPED = new ProcessorStatus("STOPPED"); /** * Status indicates the processor is resumed. */ public static ProcessorStatus RESUMED = new ProcessorStatus("RESUMED"); /** * Status indicates the processor is being cleaned up. */ public static ProcessorStatus CLEANUP = new ProcessorStatus("CLEANUP"); /** * Status indicates the processor is finished. */ public static ProcessorStatus FINISHED = new ProcessorStatus("FINISHED"); /** * Varaible holds the status ID. */ private String statusID; /** * Constructor make sure all the constants have been defined inside this * class and takes the status ID. */ private ProcessorStatus(String statusID) { this.statusID=statusID; } /** * Returns the job status in string format. */ public String toString() { return this.statusID; } } Index: JobManagerMBean.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/management/JobManagerMBean.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** JobManagerMBean.java 3 May 2006 22:11:18 -0000 1.3 --- JobManagerMBean.java 14 May 2006 01:34:49 -0000 1.4 *************** *** 6,44 **** /** * <p> ! * This standard MBean interface provodes the methods to instrument the ! * job controller. * </p> ! * @author : Suresh Pragada ! * @versio 1.0 */ public interface JobManagerMBean { /** ! * Returns the status of the job. These statuses are defined as constants in JobManagerMBean. * ! * @return Returns the job status. */ ! public JobStatus getJobStatus(); /** ! * Controller should stop its processing as soon this method call has been received. * ! * @return Returns whether job has been stopped or not. */ ! public boolean stop(); /** ! * Controller should suspend its processing as soon as its receive this method call. * ! * @return Returns true, if controller can suspend the process, false otherwise. */ ! public boolean suspend(); /** ! * Controller should resume its processing as soon as it receive this method call. * ! * @return Returns true, if controller can resume the processing, false, otherwise. */ ! public boolean resume(); /** --- 6,56 ---- /** * <p> ! * This standard MBean interface provides the methods to instrument the ! * job controller and processors running under the job controller. * </p> ! * @author Suresh Pragada ! * @version 1.0 ! * @since 1.0 */ public interface JobManagerMBean { /** ! * Returns the status of the processor identified by the given processor ID. * ! * @param processorID ID assigned to each processor. ! * ! * @return Returns the processor status. */ ! public ProcessorStatus getProcessorStatus(String processorID); /** ! * Controller should stop processing of the processor identified by the ! * given processor ID. * ! * @param processorID ID assigned to each processor. ! * ! * @return Returns true, if processor has been stopped, false otherwise. */ ! public boolean stop(String processorID); /** ! * Controller should suspend processing of the processor identified by the ! * give processor ID. * ! * @param processorID ID assigned to each processor. ! * ! * @return Returns true, if processor has been suspended, false otherwise. */ ! public boolean suspend(String processorID); /** ! * Controller should resume processing of the processor identified by the ! * given processor ID. * ! * @param processorID ID assigned to each processor. ! * ! * @return Returns true, if processor can be resumed, false, otherwise. */ ! public boolean resume(String processorID); /** Index: JobMonitor.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/management/JobMonitor.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** JobMonitor.java 28 Mar 2006 04:55:18 -0000 1.2 --- JobMonitor.java 14 May 2006 01:34:49 -0000 1.3 *************** *** 15,18 **** --- 15,19 ---- /** * <p> + * Implementation of job monitor mbean to instrument the job controller. * </p> * @author Suresh Pragada *************** *** 53,68 **** } /** ! * @see org.jmonks.batchserver.framework.management.JobMonitorMBean#getThreadIDList */ ! public String[] getThreadIDList() { ! return this.jobMonitor.getThreadIDList(); } /** ! * @see org.jmonks.batchserver.framework.management.JobMonitorMBean#getThreadState(java.lang.String) */ ! public ThreadState getThreadState(String threadID) { ! return this.jobMonitor.getThreadState(threadID); } } --- 54,69 ---- } /** ! * @see org.jmonks.batchserver.framework.management.JobMonitorMBean#getProcessorIDList */ ! public String[] getProcessorIDList() { ! return this.jobMonitor.getProcessorIDList(); } /** ! * @see org.jmonks.batchserver.framework.management.JobMonitorMBean#getProcessorState(java.lang.String) */ ! public ProcessorState getProcessorState(String processorID) { ! return this.jobMonitor.getProcessorState(processorID); } } --- ThreadState.java DELETED --- Index: JobManager.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/management/JobManager.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** JobManager.java 3 May 2006 22:11:18 -0000 1.3 --- JobManager.java 14 May 2006 01:34:49 -0000 1.4 *************** *** 38,83 **** { if(jobController==null) ! throw new IllegalArgumentException("job controller cannot be null to create the job monitor mbean."); this.jobManager=(JobManagerMBean)jobController; } /** ! * Controller should stop its processing as soon this method call has been received. * ! * @return Returns whether job has been stopped or not. */ ! public boolean stop() { ! return this.jobManager.stop() ; } /** ! * Controller should suspend its processing as soon as its receive this method call. * ! * @return Returns true, if controller can suspend the process, false otherwise. */ ! public boolean suspend() { ! return this.jobManager.suspend(); } /** ! * Controller should resume its processing as soon as it receive this method call. * ! * @return Returns true, if controller can resume the processing, false, otherwise. */ ! public boolean resume() { ! return this.jobManager.resume(); } /** ! * Returns the status of the job. These statuses are defined as constants in JobManagerMBean. * ! * @return Returns the job status. */ ! public JobStatus getJobStatus() { ! return this.jobManager.getJobStatus(); } --- 38,94 ---- { if(jobController==null) ! throw new IllegalArgumentException("job controller cannot be null to create the job manager mbean."); this.jobManager=(JobManagerMBean)jobController; } /** ! * Controller should stop processing of the processor identified by the ! * given processor ID. * ! * @param processorID ID assigned to each processor. ! * ! * @return Returns true, if processor has been stopped, false otherwise. */ ! public boolean stop(String processorID) { ! return this.jobManager.stop(processorID) ; } /** ! * Controller should suspend processing of the processor identified by the ! * give processor ID. * ! * @param processorID ID assigned to each processor. ! * ! * @return Returns true, if processor has been suspended, false otherwise. */ ! public boolean suspend(String processorID) { ! return this.jobManager.suspend(processorID); } /** ! * Controller should resume processing of the processor identified by the ! * given processor ID. * ! * @param processorID ID assigned to each processor. ! * ! * @return Returns true, if processor can be resumed, false, otherwise. */ ! public boolean resume(String processorID) { ! return this.jobManager.resume(processorID); } /** ! * Returns the status of the processor identified by the given processor ID. * ! * @param processorID ID assigned to each processor. ! * ! * @return Returns the processor status. */ ! public ProcessorStatus getProcessorStatus(String processorID) { ! return this.jobManager.getProcessorStatus(processorID); } --- NEW FILE: ProcessorState.java --- package org.jmonks.batchserver.framework.management; /** * <p> * This represents the state of the processor(thread) running under the controller. * This gives the information like processor ID, description and * processing information. * </p> * @author Suresh pragada * @version 1.0 * @since 1.0 */ public class ProcessorState { /** * Holds the processor ID. */ private String processorID; /** * Holds the processor description. */ private String processorDescription; /** * Holds the processing information. This can be anything that client and server * can understand. */ private Object processingInfo; /** * Constructor to initialize the whole object at a time and make sure it is immutable. */ public ProcessorState(String processorID,String processorDescription,Object processingInfo) { this.processorID=processorID; this.processorDescription=processorDescription; this.processingInfo=processingInfo; } /** * Returns the processor ID. */ public String getProcessorID() { return this.processorID; } /** * Returns the processor description. */ public String getProcessorDescription() { return this.processorDescription; } /** * Returns the processor processing information. */ public Object getProcessingInfo() { return this.processingInfo; } /** * <p> * Returns the string representation of ProcessorState class in the format * <br> {ProcessorState [ID = value] [desc = value] [processingInfo = value]} * </p> * * @return Returns the string representation of ProcessorState. */ public String toString() { StringBuffer stringValue=new StringBuffer("{ProcessorState "); stringValue.append("[ID = " + this.processorID + "]"); stringValue.append("[desc = " + this.processorDescription + "]"); stringValue.append("[processingInfo = " + this.processingInfo + "]"); stringValue.append("}"); return stringValue.toString(); } } --- JobStatus.java DELETED --- |
From: Suresh <sur...@us...> - 2006-05-14 01:33:56
|
Update of /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/controller/pool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv2775 Removed Files: DefaultCollectionJobPool.java OrderedCollectionJobPool.java Log Message: no message --- OrderedCollectionJobPool.java DELETED --- --- DefaultCollectionJobPool.java DELETED --- |
From: Suresh <sur...@us...> - 2006-05-14 01:31:36
|
Update of /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/controller/pool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv2130 Modified Files: AbstractPoolJobLoader.java CollectionJobPool.java JobPool.java PoolJobController.java PoolJobLoader.java PoolJobProcessor.java Log Message: no message Index: PoolJobLoader.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/controller/pool/PoolJobLoader.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PoolJobLoader.java 4 Mar 2006 04:42:01 -0000 1.2 --- PoolJobLoader.java 14 May 2006 01:31:32 -0000 1.3 *************** *** 1,27 **** package org.jmonks.batchserver.framework.controller.pool; import java.util.Map; /** ! * Loader is the one which loads the job data into the pool. This inteface defines the responsibilites of the loader and some of these responsibilities will be implemented by AbstractPoolJobLoader. * ! * @author : Suresh Pragada ! * @version 1.0 */ public interface PoolJobLoader { public void cleanup(); ! ! public int loadPool(); ! public boolean suspend(); ! public boolean resume(); ! public boolean stop(); ! public int getTotalRecords(); ! public Object getLoaderState(); ! ! public void initialize(Map configProps, org.jmonks.batchserver.framework.controller.pool.JobPool pool); } --- 1,69 ---- package org.jmonks.batchserver.framework.controller.pool; import java.util.Map; + import org.jmonks.batchserver.framework.management.ProcessorStatus; /** ! * PoolJobLoader loads the job data into the pool to be processed by ! * PoolJobProcessor(s). * ! * @author Suresh Pragada ! * @version 1.0 ! * @since 1.0 */ public interface PoolJobLoader { + /** + * Chance for the loader to initialize itself with the properties defined + * in the job configuration and gets the reference to the job pool. + * + * @param configProps Configuration defined for the loader. + * @param pool Job Pool reference. + */ + public void initialize(Map configProps, JobPool pool); + /** + * Chance to do some cleanup before the job being shutdown. + */ public void cleanup(); ! /** ! * Loads the job data to the job pool. When finished loading of all the job ! * data, loads the <i>NULL</i> into the pool. ! */ ! public void loadJobData(); ! /** ! * Suspends the loader. ! * ! * @return Returns true if loader is suspended, false otherwise. ! */ public boolean suspend(); ! /** ! * Resumes the loader. ! * ! * @return Returns true if loader is resumed, false otherwise. ! */ public boolean resume(); ! /** ! * Stops the loader. ! * ! * @return Returns true if loader is stopped, false otherwise. ! */ public boolean stop(); ! /** ! * Gets the total records this loader is going to load. ! * ! * @return Returns the number of records this loader is going to load. ! */ public int getTotalRecords(); ! /** ! * Gets the loader state as object which can be understan by the monitoring ! * client. Usually, this would be used for display purposes. ! * ! * @return Returns the displayable object representing the loader state. ! */ public Object getLoaderState(); ! /** ! * Gets the loader status. ! * ! * @return Returns the loader status. ! */ ! public ProcessorStatus getLoaderStatus(); } Index: JobPool.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/controller/pool/JobPool.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** JobPool.java 4 Mar 2006 04:42:01 -0000 1.2 --- JobPool.java 14 May 2006 01:31:32 -0000 1.3 *************** *** 3,25 **** /** ! * <p> ! * Pool provides the interface to load the job information into it and retrieves the job information from the pool. ! * </p> * ! * @author : Suresh Pragada ! * @version 1.0 */ ! public interface JobPool { ! public boolean loadJobData(Object jobData); ! ! public Object getNextJobData(); ! ! public void initialize(Map configProps); ! public void cleanup(); ! public int getLoadedCount(); ! ! public void getProcessedCount(); } --- 3,59 ---- /** ! * <p> ! * JobPool pools all the job data being loaded by the loader and serves this data ! * when job processors requests for the processing. This interface enables the loader, ! * processor and controller to interact with the pool implementation. ! * </p> * ! * @author Suresh Pragada ! * @version 1.0 ! * @since 1.0 */ ! public interface JobPool { ! /** ! * Controller calls this method with the properties defined in the configuration ! * before reference is being passed to the job loader and job processor. ! * ! * @param configProps Properties defined in the configuration for the job pool. ! */ ! public void initialize(Map configProps); ! /** ! * Gets the next available job data(piece of information) to be processed. ! * If it is not available, it will be waited until it gets the next job data. ! * If loader is done with loading the jobs, it returns null. At this time, ! * processor should quit its processing. ! * ! * @return Returns the next available job data to be process, ! * null if no job data is available. ! */ ! public Object getNextJobData(); ! /** ! * Job Loader will use this API to load the job data into the pool. ! * If job loader is done with the loading all the data to be processed, ! * it should load null indicating that loading of all the job data has been ! * done. ! * ! * @param jobData Job data needs to be processed. ! */ ! public boolean loadJobData(Object jobData); ! /** ! * Controller calls this method after job processing has been done. ! */ public void cleanup(); ! /** ! * Returns the number of job data objects being loaded into the pool. ! * ! * @return Returns the number of job data objects being loaded into the pool. ! */ public int getLoadedCount(); ! /** ! * Returns the number of job data objects being processed from the pool. ! * ! * @return Returns the number of job data objects have been processed so far. ! */ ! public int getProcessedCount(); } Index: PoolJobProcessor.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/controller/pool/PoolJobProcessor.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PoolJobProcessor.java 4 Mar 2006 04:42:01 -0000 1.2 --- PoolJobProcessor.java 14 May 2006 01:31:32 -0000 1.3 *************** *** 2,26 **** import java.util.Map; /** ! * Processor is the one which processes the job data. This interface defines the responsiblities of the job processor. * ! * @author : Suresh pragada ! * @version 1.0 */ public interface PoolJobProcessor { public boolean suspend(); ! public boolean resume(); ! public boolean stop(); ! public void cleanup(); ! ! public int processPool(); ! public Object getProcessorState(); ! ! public void initialize(Map configProps, org.jmonks.batchserver.framework.controller.pool.JobPool pool); } --- 2,65 ---- import java.util.Map; + import org.jmonks.batchserver.framework.management.ProcessorStatus; /** ! * PoolJobProcessor gets the job data to be processed from the job pool and ! * processes it. * ! * @author Suresh pragada ! * @version 1.0 ! * @since 1.0 */ public interface PoolJobProcessor { + /** + * Chance to initialize itself using the information configured for this job + * processor in job configuration. + * + * @param configProps Configuration defined for the job processor in job configuration. + * @param pool Reference to Job Pool. + */ + public void initialize(Map configProps, JobPool pool); + /** + * Suspends the pool job processor. + * + * @return Returns true if processor is suspended, false otherwise. + */ public boolean suspend(); ! /** ! * Resumes the pool job processor. ! * ! * @return Returns true if processor is resumed, false otherwise. ! */ public boolean resume(); ! /** ! * Stops the processor. ! * ! * @return Returns true if processor is stopped, false otherwise. ! */ public boolean stop(); ! /** ! * Chance to do any cleanup at the end of the processing. ! */ public void cleanup(); ! /** ! * Process the job data getting from the job pool and quits when job pool ! * out of the job data(returns null). ! * ! * @return Returns the number of job data instances being procssed. ! */ ! public int process(); ! /** ! * Gets the processor to be displyed or anaylyzed for the monitoring purposes. ! * ! * @return Returns an object understanble/displayable by monitoring client. ! */ public Object getProcessorState(); ! /** ! * Gets the processor status being used by the management clients. ! * ! * @return Returns the status of the job. ! */ ! public ProcessorStatus getProcessorStatus(); } Index: AbstractPoolJobLoader.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/controller/pool/AbstractPoolJobLoader.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** AbstractPoolJobLoader.java 4 Mar 2006 04:42:01 -0000 1.2 --- AbstractPoolJobLoader.java 14 May 2006 01:31:32 -0000 1.3 *************** *** 19,23 **** } ! public abstract int loadJobData(); public abstract void initialize(Map configProps); --- 19,23 ---- } ! public abstract void load(); public abstract void initialize(Map configProps); Index: PoolJobController.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/controller/pool/PoolJobController.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** PoolJobController.java 3 May 2006 22:11:18 -0000 1.6 --- PoolJobController.java 14 May 2006 01:31:32 -0000 1.7 *************** *** 1,169 **** package org.jmonks.batchserver.framework.controller.pool; import org.jmonks.batchserver.framework.common.ErrorCode; - import org.jmonks.batchserver.framework.config.JobControllerConfig; import org.jmonks.batchserver.framework.controller.JobController; ! ! ! /** * <p> ! * 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 this information from pool and process them. As this subclasses the abstract JobController, it implements all the management and monitoring methods. It provides the abstract loader and processor classes to be overriden by job implementation and comes with different implementation of pools. * <br><br> ! * 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. * * <br><br> ! * XML Configuration is as follows <br><br> * <pre> ! * <job-config job-name="process_file_abc"> ! * <job-controller controller-class-name="org.jmonks.batchserver.framework.controller.pool.PoolJobController" ! * controller-config-class-name="org.jmonks.batchserver.framework.config.PoolControllerConfig"> ! * <job-loader pool-job-loader-class-name="com.mycompany.batch.processfileabc.AbcJobLoader"> ! * <property key="loader-info1">loader-value1</property> ! * </job-loader> ! * <job-processor pool-job-processor-class-name="com.mycompany.batch.processfileabc.AbcJobLoader"> ! * <thread-count>1</thread-count> ! * <property key="processor-info1">processor-value1</property> ! * </job-processor> ! * <job-pool job-pool-class-name="org.jmonks.batchserver.framework.controller.pool.DefaultJobPool"> ! * <property key="pool-size">50000</property> ! * </job-pool> ! * <property key="controller-info1">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> * </p> ! * @author : Suresh Pragada ! * @version 1.0 */ public class PoolJobController extends JobController { ! ! private PoolJobProcessor mJobProcessor; ! ! private JobPool mJobPool; ! ! private PoolJobLoader mPoolJobLoader; ! public PoolJobController(JobControllerConfig config) { - } public ErrorCode process() - { return null; - } /** ! * Returns the total number of records this job gonna process. This information will be obtained from the pool loader. * ! * @return Returns the number of records this job gonna process. */ public int getExpectedRecordsCount() - - - { return 0; - - - } /** ! * Number of records this job processed so far. This information will be obtained from the pool. * ! * @return Returns the number of records processed so far. */ public int getProcessedRecordsCount() - - { return 0; - - } /** ! * Returns the number of threads creates to process this job. This includes each thread for loader and pool and the specified number of threads for the processor. ! * ! * @return Returns the number of threads controller created to process this job. */ ! public java.lang.String[] getThreadIDList() ! ! { return null; - - } /** ! * Returns the current state of the thread. * ! * @param threadNo Thread number. ! * @return Retuns the current state of the thread. */ ! public org.jmonks.batchserver.framework.management.ThreadState getThreadState(String threadID) ! ! { return null; - - } /** ! * Returns the status of the job. * ! * @return Returns the status of the job. */ ! public org.jmonks.batchserver.framework.management.JobStatus getJobStatus() ! ! { return null; - - } /** ! * This calls the stop method on the loader processor and persists the loader, pool and processor, if restart flag is true and return with appropriate return code. */ ! public boolean stop() ! { return true; - } /** ! * This calls the suspend on the loader and processor threads. ! * ! * @return Returns true, if it could suspend the processes, false, otherwise. */ ! public boolean suspend() ! { return true; - } /** ! * This would resume the job. ! * ! * @return Returns true, if it could resume the job, false otherwise. */ ! public boolean resume() ! { return true; - } } --- 1,161 ---- package org.jmonks.batchserver.framework.controller.pool; import org.jmonks.batchserver.framework.common.ErrorCode; import org.jmonks.batchserver.framework.controller.JobController; ! import org.jmonks.batchserver.framework.management.ProcessorState; ! import org.jmonks.batchserver.framework.management.ProcessorStatus; /** * <p> ! * 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. * <br><br> ! * 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. * * <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.pool.PoolJobController" ! * controller-config-class-name="org.jmonks.batchserver.framework.config.PoolControllerConfig"> ! * <job-loader pool-job-loader-class-name="com.mycompany.batch.processfileabc.AbcJobLoader"> ! * <property key="loader-info1">loader-value1</property> ! * </job-loader> ! * <job-processor pool-job-processor-class-name="com.mycompany.batch.processfileabc.AbcJobLoader"> ! * <thread-count>1</thread-count> ! * <property key="processor-info1">processor-value1</property> ! * </job-processor> ! * <job-pool job-pool-class-name="org.jmonks.batchserver.framework.controller.pool.DefaultJobPool"> ! * <property key="pool-size">50000</property> ! * </job-pool> ! * <property key="controller-info1">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> + * <tr><td>Column</td><td>Value</td></tr> + * </table> * </p> ! * ! * @author Suresh Pragada ! * @version 1.0 ! * @since 1.0 */ public class PoolJobController extends JobController { ! /** ! * Constructor enables the instantiation of the pool job controller instance. ! */ ! public PoolJobController() { } + /** + * <p> + * Executes the job by creating the pool, loader and processor(s) based + * on the configuration and have them work accordingly to process the job. + * </p> + * + * @return Returns the processing error code for the job. + */ public ErrorCode process() { return null; } /** ! * Returns the total number of records this job going to process. ! * This information will be obtained from the pool loader. * ! * @return Returns the number of records this job goint to process. */ public int getExpectedRecordsCount() { return 0; } /** ! * Number of records got processed so far. ! * This information will be obtained from the pool. * ! * @return Returns the number of records processed so far. */ public int getProcessedRecordsCount() { return 0; } /** ! * Returns the IDs assigned to all the processors, loader as a string array. ! * ! * @return Returns the string array consist of all the processor(s) and loader IDs. */ ! public java.lang.String[] getProcessorIDList() { return null; } /** ! * Returns the current state of the processor identified by the given processor ! * ID as the ProcessorState object. * ! * @param processorID processor ID identifies the processor or loader. ! * ! * @return Retuns the current state of the required processor. */ ! public ProcessorState getProcessorState(String processorID) { return null; } /** ! * Returns the status of the processor identified by the given processor ID. * ! * @return Returns the status of the required processor. */ ! public ProcessorStatus getProcessorStatus(String processorID) { return null; } /** ! * Stops the processor identified by the given processor ID. ! * ! * @return Returns true, if processor could be stopped, false otherwise. */ ! public boolean stop(String processorID) { return true; } /** ! * Suspends the processor identified by the given processor ID. ! * ! * @return Returns true if it could suspend the processor, false otherwise. */ ! public boolean suspend(String processorID) { return true; } /** ! * Resumes the processor identified by given processor ID. ! * ! * @return Returns true if processor is resumed, false otherwise. */ ! public boolean resume(String processorID) { return true; } } Index: CollectionJobPool.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/controller/pool/CollectionJobPool.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** CollectionJobPool.java 4 Mar 2006 04:42:01 -0000 1.2 --- CollectionJobPool.java 14 May 2006 01:31:32 -0000 1.3 *************** *** 1,49 **** package org.jmonks.batchserver.framework.controller.pool; ! ! import java.util.List; import java.util.Map; /** ! * <p> ! * This provides the pool implementaiton using java utility collections. This is the default implementatio of pool, unless developer configured an another one. ! * </p> * ! * @author : Suresh Pragada ! * @version 1.0 */ ! public abstract class CollectionJobPool implements JobPool { public CollectionJobPool() { } - public abstract List getCollection(); - public boolean loadJobData(Object jobData) { ! return true; } public Object getNextJobData() { ! return null; } public void initialize(Map configProps) { } public void cleanup() { } public int getLoadedCount() - { ! return 0; } ! public void getProcessedCount() { } } --- 1,150 ---- package org.jmonks.batchserver.framework.controller.pool; ! import EDU.oswego.cs.dl.util.concurrent.BoundedBuffer; ! import java.util.Hashtable; import java.util.Map; + import org.apache.log4j.Logger; /** ! * <p> ! * Provides the implementation of job pool using java utility collections. ! * This job pool implementation can be configured for any given job using the ! * following configuration in job configuration.<br> ! * <pre> ! * <job-pool job-pool-class-name="org.jmonks.batchserver.framework.controller.pool.CollectionJobPool"> ! * <property key="job-pool-size">50000</property> ! * </job-pool> ! * </pre> ! * </p> * ! * @author Suresh Pragada ! * @version 1.0 ! * @since 1.0 */ ! public class CollectionJobPool implements JobPool { + /** + * Default collection pool size. This will be used when pool size is not + * configured or problem in obtaining the pool size. + */ + public static final int DEFAULT_COLLECTION_POOL_SIZE = 1000; + /** + * Property name by which pool size will be associated with. + */ + protected static final String POOL_SIZE_PROPERTY_NAME = "job-pool-size"; + /** + * Map holds the configuration defined for the job pool. There might be properies + * needed other than initialization. + */ + protected Map configProps=null; + /** + * Java utility collection holds the job data objects. + */ + protected BoundedBuffer pool=null; + /** + * Holds the number of job data objects have been loaded by job loader. + */ + protected int loadedJobsCount=0; + /** + * Holds the number of job data objects have been served to job processors. + */ + protected int processedJobsCount=0; + + private static Logger logger=Logger.getLogger(CollectionJobPool.class); + + /** + * Default constructor for the instantiation purposes. + */ public CollectionJobPool() { } public boolean loadJobData(Object jobData) { ! boolean loaded=false; ! while(!loaded) ! { ! try ! { ! this.pool.put(jobData); ! loaded=true; ! this.loadedJobsCount++; ! } ! catch(InterruptedException exception) ! { ! logger.info("Got exception while loading the job data = " + jobData, exception); ! } ! } ! return loaded; } public Object getNextJobData() { ! Object jobData=null; ! try ! { ! jobData=this.pool.take(); ! this.processedJobsCount++; ! } ! catch(InterruptedException exception) ! { ! logger.info("Got exception while getting the job data from pool", exception); ! } ! return jobData; } + /** + * Initializes the collection job pool using the configuration defined + * in the job configuration. It tries to get the pool size from the given configuration, + * by looking for the property "job-pool-size", if it couldnt find it uses the default pool size "1000" + * and initializes the collection to be used as the pool. + * + * @param configProps Configuration defined for the job pool. + */ public void initialize(Map configProps) { + this.configProps=new Hashtable(configProps); + /** + * Try to get the pool size from configuration... If unable to get use default size. + */ + int poolSize=CollectionJobPool.DEFAULT_COLLECTION_POOL_SIZE; + String poolSizePropertyValue=(String)this.configProps.get(CollectionJobPool.POOL_SIZE_PROPERTY_NAME); + if(poolSizePropertyValue!=null) + { + logger.info("Received the pool size " + poolSizePropertyValue + " from configuration"); + try + { + poolSize=Integer.parseInt(poolSizePropertyValue); + } + catch(Exception exception) + { + logger.info("Exception while obtaining the pool size from configuration... Using the default pool size"); + } + } + else + { + logger.info("pool size has not been configured.. using the default pool size"); + } + this.pool=new BoundedBuffer(poolSize); } + /** + * Removes all the entries from collection. + */ public void cleanup() { + /** + * Nothing to do the cleanup. + */ + logger.debug("Cleanup has been done"); } public int getLoadedCount() { ! return this.loadedJobsCount; } ! public int getProcessedCount() { + return this.processedJobsCount; } } |
From: Suresh <sur...@us...> - 2006-05-14 01:24:24
|
Update of /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/controller/basic In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv32376 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.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** BasicJobProcessor.java 5 May 2006 21:06:57 -0000 1.7 --- BasicJobProcessor.java 14 May 2006 01:24:18 -0000 1.8 *************** *** 3,6 **** --- 3,7 ---- import org.apache.log4j.Logger; import org.jmonks.batchserver.framework.common.ErrorCode; + import org.jmonks.batchserver.framework.management.ProcessorStatus; /** *************** *** 24,27 **** --- 25,32 ---- */ private boolean threadRegistered=false; + /** + * Indicates the status of this processor. + */ + protected ProcessorStatus processorStatus=ProcessorStatus.INSTANTIATED; private static Logger logger=Logger.getLogger(BasicJobProcessor.class); *************** *** 64,69 **** public boolean suspend() { ! this.processorThread.suspend(); ! return true; } /** --- 69,80 ---- public boolean suspend() { ! if(this.processorStatus!=ProcessorStatus.SUSPENDED) ! { ! this.processorThread.suspend(); ! this.processorStatus=ProcessorStatus.SUSPENDED; ! return true; ! } ! else ! return false; } /** *************** *** 80,85 **** public boolean resume() { ! this.processorThread.resume(); ! return true; } /** --- 91,102 ---- public boolean resume() { ! if(this.processorStatus==ProcessorStatus.SUSPENDED) ! { ! this.processorThread.resume(); ! this.processorStatus=ProcessorStatus.RUNNING; ! return true; ! } ! else ! return false; } /** *************** *** 96,101 **** public boolean stop() { ! this.processorThread.stop(); ! return true; } --- 113,125 ---- public boolean stop() { ! if(this.processorStatus!=ProcessorStatus.STOPPED || ! this.processorStatus!=ProcessorStatus.FINISHED) ! { ! this.processorThread.stop(); ! this.processorStatus=ProcessorStatus.STOPPED; ! return true; ! } ! else ! return false; } *************** *** 134,146 **** /** ! * This is for monitoring applications to know the exact state of this particular ! * (if there are multiple job processors) job processor. This returns object * which can be used for the purpose of display. * ! * @return Returns the exact state this processor. */ public abstract Object getProcessorState(); /** * This is for monitoring applications to know how many records this particular * (if there are multiple job processors) job processor is going to process. --- 158,185 ---- /** ! * This is for monitoring applications to know what the information (record) ! * this job processor is processing. Implementers should provide the ! * granular level of information that this processor is processing at this time ! * for better monitoring of this job. This returns object * which can be used for the purpose of display. * ! * @return Returns the information (record) this processor is processing. */ public abstract Object getProcessorState(); /** + * Returns the status of the processor as a ProcessorStatus object, which gives + * the information like whether the processor is running, suspended, resumed + * or stopped. Defalt implementation of this method returns the status based + * on the default implementation of suspend, resume and stop methods. + * + * @return Returns the processor status. + */ + public ProcessorStatus getProcessorStatus() + { + return this.processorStatus; + } + + /** * This is for monitoring applications to know how many records this particular * (if there are multiple job processors) job processor is going to process. Index: BasicJobController.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/controller/basic/BasicJobController.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** BasicJobController.java 5 May 2006 21:06:57 -0000 1.8 --- BasicJobController.java 14 May 2006 01:24:18 -0000 1.9 *************** *** 14,19 **** import org.jmonks.batchserver.framework.config.ConfigurationException; import org.jmonks.batchserver.framework.controller.JobController; ! import org.jmonks.batchserver.framework.management.JobStatus; ! import org.jmonks.batchserver.framework.management.ThreadState; /** --- 14,19 ---- import org.jmonks.batchserver.framework.config.ConfigurationException; import org.jmonks.batchserver.framework.controller.JobController; ! import org.jmonks.batchserver.framework.management.ProcessorStatus; ! import org.jmonks.batchserver.framework.management.ProcessorState; /** *************** *** 40,47 **** */ private Map jobProcessorsResultMap=new Hashtable(); - /** - * Represents the status of the job. - */ - private JobStatus jobStatus=null; private static Logger logger=Logger.getLogger(BasicJobController.class); --- 40,43 ---- *************** *** 67,71 **** { logger.info("Entering process in basic job controller = " + super.getJobName()); - this.jobStatus=JobStatus.RUNNING; BasicJobControllerConfig basicJobControllerConfig=(BasicJobControllerConfig)super.getJobControllerConfig(); int threadCount=basicJobControllerConfig.getBasicJobProcessThreadCount(); --- 63,66 ---- *************** *** 151,319 **** * Returns the IDs of all the processors as string array. * ! * @return Returns the string array consist of all the processor thread IDs. */ ! public String[] getThreadIDList() { ! logger.trace("Entering getThreadIDList"); ! String threadIDList[]=new String[this.jobProcessorsMap.size()]; int i=0; for(Iterator iterator=this.jobProcessorsMap.keySet().iterator();iterator.hasNext();i++) ! threadIDList[i]=(String)iterator.next(); ! logger.trace("Exiting getThreadIDList"); ! return threadIDList; } /** ! * Returns the state of the requested thread as a ThreadState object. */ ! public ThreadState getThreadState(String threadID) { ! ThreadState state=null; ! if(threadID!=null && this.jobProcessorsMap.containsKey(threadID)) ! { ! BasicJobProcessor jobProcessor=(BasicJobProcessor)this.jobProcessorsMap.get(threadID); ! state=new ThreadState(threadID, "Basic Job Processor", jobProcessor.getProcessorState()); ! } else - { state=null; ! } ! logger.trace("Exiting getThreadState = " + state); return state; } /** ! * <p> ! * Returns the status of the job. Possible values are... <br> ! * <table> ! * <tr><td><b>Status</b></td></tr> ! * <tr><td>RUNNING</td></tr> ! * <tr><td>SUSPENDED</td></tr> ! * </p> */ ! public JobStatus getJobStatus() { ! return this.jobStatus; } /** ! * Stops the job by stopping all the job processors. */ ! public boolean stop() { ! logger.trace("Entering stop"); boolean stopped=true; ! ! for(Iterator iterator=this.jobProcessorsMap.values().iterator();iterator.hasNext();) ! { ! BasicJobProcessor jobProcessor=(BasicJobProcessor)iterator.next(); ! boolean processorStopped=jobProcessor.suspend(); ! /** ! * What should we do in case of job processor not being stopped. ! */ ! } ! ! if(stopped) ! this.jobStatus=JobStatus.STOPPED; ! logger.trace("Exiting stop = " + stopped); return stopped; } /** ! * Suspends the job by suspending all the job processors. If it couldnt suspend any one of the job processor, ! * it will rollback all the earlier suspends. * ! * @return Returns true if it could suspend the job, false otherwise. */ ! public boolean suspend() { ! logger.trace("Entering suspend"); boolean suspended=true; ! ! if(this.jobStatus==JobStatus.RUNNING) ! { ! List suspendedProcessorList=new ArrayList(); ! for(Iterator iterator=this.jobProcessorsMap.values().iterator();iterator.hasNext();) ! { ! BasicJobProcessor jobProcessor=(BasicJobProcessor)iterator.next(); ! boolean processorSuspended=jobProcessor.suspend(); ! if(processorSuspended) ! { ! suspendedProcessorList.add(jobProcessor); ! } ! else ! { ! /** ! * Add to the suspended list... in case to be rolled back rollbck everyone in the suspended list. ! */ ! logger.error("Unable to suspend one of the processor.. So rolling back the changes"); ! suspended=false; ! for(Iterator subIterator=suspendedProcessorList.iterator();subIterator.hasNext();) ! { ! ((BasicJobProcessor)subIterator.next()).resume(); ! } ! break; ! } ! } ! ! if(suspended) ! this.jobStatus=JobStatus.SUSPENDED; ! } else - { suspended=false; ! logger.info("Job current status is not RUNNING to suspend"); ! } ! logger.trace("Exiting suspend = " + suspended); return suspended; } /** ! * Resumes of the job processing by resuming all the job processors. * ! * @return Returns true if job can be resumed, false otherwise. */ ! public boolean resume() { ! logger.trace("Entering resume"); boolean resumed=true; ! ! if(this.jobStatus==JobStatus.SUSPENDED) ! { ! List resumedProcessorList=new ArrayList(); ! for(Iterator iterator=this.jobProcessorsMap.values().iterator();iterator.hasNext();) ! { ! BasicJobProcessor jobProcessor=(BasicJobProcessor)iterator.next(); ! boolean processorResumed=jobProcessor.suspend(); ! if(processorResumed) ! { ! resumedProcessorList.add(jobProcessor); ! } ! else ! { ! /** ! * Add to the resumed list... in case to be rolled back rollbck everyone in the resumed list. ! */ ! logger.error("Unable to resume one of the processor.. So rolling back the changes"); ! resumed=false; ! for(Iterator subIterator=resumedProcessorList.iterator();subIterator.hasNext();) ! { ! ((BasicJobProcessor)subIterator.next()).suspend(); ! } ! break; ! } ! } ! ! if(resumed) ! this.jobStatus=JobStatus.RUNNING; ! } else - { resumed=false; ! logger.error("Job is not in SUSPENDED status to resume"); ! } ! logger.trace("Exiting resume = " + resumed); return resumed; } --- 146,251 ---- * Returns the IDs of all the processors as string array. * ! * @return Returns the string array consist of all the processor IDs. */ ! public String[] getProcessorIDList() { ! logger.trace("Entering getProcessorIDList"); ! String processorIDList[]=new String[this.jobProcessorsMap.size()]; int i=0; for(Iterator iterator=this.jobProcessorsMap.keySet().iterator();iterator.hasNext();i++) ! processorIDList[i]=(String)iterator.next(); ! logger.trace("Exiting getProcessorIDList"); ! return processorIDList; } /** ! * Returns the state of the requested processor as a ProcessorState object. ! * ! * @return Returns the processor state. */ ! public ProcessorState getProcessorState(String processorID) { ! logger.trace("Exiting getProcessorState = " + processorID); ! ProcessorState state=null; ! BasicJobProcessor jobProcessor=(BasicJobProcessor)this.jobProcessorsMap.get(processorID); ! if(jobProcessor!=null) ! state=new ProcessorState(processorID, "Basic Job Processor", jobProcessor.getProcessorState()); else state=null; ! logger.trace("Exiting getProcessorState = " + processorID + " state = " + state); return state; } /** ! * Returns the status of the processor identified by the given processor ID. ! * ! * @return Returns the ProcessorStatus object represents the status. */ ! public ProcessorStatus getProcessorStatus(String processorID) { ! logger.trace("Exiting getProcessorStatus = " + processorID); ! ProcessorStatus status=null; ! BasicJobProcessor jobProcessor=(BasicJobProcessor)this.jobProcessorsMap.get(processorID); ! if(jobProcessor!=null) ! status=jobProcessor.getProcessorStatus(); ! else ! status=null; ! logger.trace("Exiting getProcessorStatus = " + processorID + " state = " + status); ! return status; } /** ! * Stops the processor identified by the given processor ID. ! * ! * @return Returns true, if processor could be stopped, false otherwise. */ ! public boolean stop(String processorID) { ! logger.trace("Entering stop = " + processorID); boolean stopped=true; ! BasicJobProcessor jobProcessor=(BasicJobProcessor)this.jobProcessorsMap.get(processorID); ! if(jobProcessor!=null) ! stopped=jobProcessor.stop(); ! else ! stopped=false; ! logger.trace("Exiting stop = " + processorID + " status = " + stopped); return stopped; } /** ! * Suspends the processor identified by the given processor ID. * ! * @return Returns true if it could suspend the processor, false otherwise. */ ! public boolean suspend(String processorID) { ! logger.trace("Entering suspend = " + processorID); boolean suspended=true; ! BasicJobProcessor jobProcessor=(BasicJobProcessor)this.jobProcessorsMap.get(processorID); ! if(jobProcessor!=null) ! suspended=jobProcessor.suspend(); else suspended=false; ! logger.trace("Exiting suspend = " + processorID + " suspended = " + suspended); return suspended; } /** ! * Resumes the processor identified by given processor ID. * ! * @return Returns true if processor is resumed, false otherwise. */ ! public boolean resume(String processorID) { ! logger.trace("Entering resume = " + processorID); boolean resumed=true; ! BasicJobProcessor jobProcessor=(BasicJobProcessor)this.jobProcessorsMap.get(processorID); ! if(jobProcessor!=null) ! resumed=jobProcessor.resume(); else resumed=false; ! logger.trace("Exiting resume = " + processorID + " resumed = " + resumed); return resumed; } |
From: Suresh <sur...@us...> - 2006-05-05 21:07:18
|
Update of /cvsroot/batchserver/batchserver/test/org/jmonks/batchserver/framework/controller/basic In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25281/org/jmonks/batchserver/framework/controller/basic Modified Files: TestBasicJobProcessor.java Log Message: no message Index: TestBasicJobProcessor.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/test/org/jmonks/batchserver/framework/controller/basic/TestBasicJobProcessor.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TestBasicJobProcessor.java 4 May 2006 22:27:14 -0000 1.1 --- TestBasicJobProcessor.java 5 May 2006 21:07:10 -0000 1.2 *************** *** 57,68 **** public ErrorCode process() { - try - { - Thread.currentThread().sleep(3000); - } - catch(InterruptedException exception) - { - logger.error(exception.getMessage(),exception); - } return ErrorCode.JOB_CONFIGURATION_ERROR; } --- 57,60 ---- |
From: Suresh <sur...@us...> - 2006-05-05 21:07:10
|
Update of /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/management In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24933/org/jmonks/batchserver/framework/management Modified Files: ThreadState.java Log Message: no message Index: ThreadState.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/management/ThreadState.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ThreadState.java 25 Mar 2006 19:29:57 -0000 1.1 --- ThreadState.java 5 May 2006 21:06:57 -0000 1.2 *************** *** 30,34 **** * Constructor to initialize the whole object at a time and make sure it is immutable. */ ! public ThreadState(String threadID,String threadDescription,String processingInfo) { this.threadID=threadID; --- 30,34 ---- * Constructor to initialize the whole object at a time and make sure it is immutable. */ ! public ThreadState(String threadID,String threadDescription,Object processingInfo) { this.threadID=threadID; |
From: Suresh <sur...@us...> - 2006-05-05 21:07:06
|
Update of /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/controller/basic In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24933/org/jmonks/batchserver/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.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** BasicJobProcessor.java 4 May 2006 22:26:26 -0000 1.6 --- BasicJobProcessor.java 5 May 2006 21:06:57 -0000 1.7 *************** *** 1,4 **** --- 1,5 ---- package org.jmonks.batchserver.framework.controller.basic; import java.util.Map; + import org.apache.log4j.Logger; import org.jmonks.batchserver.framework.common.ErrorCode; *************** *** 15,18 **** --- 16,55 ---- { /** + * Holds the thread references this processor has been spawned. + * This reference will be used to suspend, resume and stop the processor. + */ + protected Thread processorThread=null; + /** + * Indicates that thread has been registered or not. + */ + private boolean threadRegistered=false; + + private static Logger logger=Logger.getLogger(BasicJobProcessor.class); + + /** + * Gets the thread reference this processor is going to be executed on. + * If processorThread has already initialized, it ignores this request. + * + * @return Returns true if thread has been registered with the processor, false otherwise. + */ + final boolean registerThread() + { + logger.trace("Entering registerThread"); + boolean registered=true; + if(!threadRegistered) + { + this.processorThread=Thread.currentThread(); + logger.debug("Registering the thread = " + this.processorThread.getName()); + this.threadRegistered=true; + } + else + { + registered=false; + } + logger.trace("Exiting registerThread"); + return registered; + } + + /** * <p> * Basic job controller calls this method to suspend the job processor, when it receives *************** *** 27,30 **** --- 64,68 ---- public boolean suspend() { + this.processorThread.suspend(); return true; } *************** *** 42,45 **** --- 80,84 ---- public boolean resume() { + this.processorThread.resume(); return true; } *************** *** 57,60 **** --- 96,100 ---- public boolean stop() { + this.processorThread.stop(); return true; } *************** *** 95,100 **** /** * This is for monitoring applications to know the exact state of this particular ! * (if there are multiple job processors) job processor. This can return any object ! * which can be converted to display. * * @return Returns the exact state this processor. --- 135,140 ---- /** * This is for monitoring applications to know the exact state of this particular ! * (if there are multiple job processors) job processor. This returns object ! * which can be used for the purpose of display. * * @return Returns the exact state this processor. *************** *** 108,112 **** * @return Returns the number of records/jobs this processor is going to process. */ ! public abstract int getTotalCount(); /** --- 148,152 ---- * @return Returns the number of records/jobs this processor is going to process. */ ! public abstract int getTotalRecordsCount(); /** *************** *** 116,119 **** * @return Returns the number of records/jobs this processor has finished processing. */ ! public abstract int getProcessedCount(); } --- 156,159 ---- * @return Returns the number of records/jobs this processor has finished processing. */ ! public abstract int getProcessedRecordsCount(); } Index: BasicJobController.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/controller/basic/BasicJobController.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** BasicJobController.java 4 May 2006 22:26:26 -0000 1.7 --- BasicJobController.java 5 May 2006 21:06:57 -0000 1.8 *************** *** 3,9 **** --- 3,11 ---- import EDU.oswego.cs.dl.util.concurrent.CountDown; import EDU.oswego.cs.dl.util.concurrent.FutureResult; + import java.util.ArrayList; import java.util.HashMap; import java.util.Hashtable; import java.util.Iterator; + import java.util.List; import java.util.Map; import org.apache.log4j.Logger; *************** *** 38,41 **** --- 40,47 ---- */ private Map jobProcessorsResultMap=new Hashtable(); + /** + * Represents the status of the job. + */ + private JobStatus jobStatus=null; private static Logger logger=Logger.getLogger(BasicJobController.class); *************** *** 61,64 **** --- 67,71 ---- { logger.info("Entering process in basic job controller = " + super.getJobName()); + this.jobStatus=JobStatus.RUNNING; BasicJobControllerConfig basicJobControllerConfig=(BasicJobControllerConfig)super.getJobControllerConfig(); int threadCount=basicJobControllerConfig.getBasicJobProcessThreadCount(); *************** *** 102,106 **** /** ! * Returns the total number of records. * * @return Returns the total number of records the job going to process. --- 109,114 ---- /** ! * Returns the total number of records this job going to process. This will be ! * the sum of the expected count from all the job processors. * * @return Returns the total number of records the job going to process. *************** *** 108,168 **** public int getExpectedRecordsCount() { ! return 0; } /** ! * Returns the number of records processed so far. */ public int getProcessedRecordsCount() { ! return 0; } /** ! * Returns the thread count. */ public String[] getThreadIDList() { ! return null; } /** ! * Returns the state of the thread as a ThreadState object. */ public ThreadState getThreadState(String threadID) { ! return null; } /** ! * Returns the job status. */ public JobStatus getJobStatus() { ! return null; } /** ! * Stops the job. */ public boolean stop() { ! return true; } /** ! * Suspends the job. */ public boolean suspend() { ! return true; } /** ! * Resume the job */ public boolean resume() { ! return true; } --- 116,320 ---- public int getExpectedRecordsCount() { ! logger.trace("Entering getExpectedRecordsCount"); ! int expectedRecordsCount=0; ! ! for(Iterator iterator=this.jobProcessorsMap.values().iterator();iterator.hasNext();) ! { ! BasicJobProcessor jobProcessor=(BasicJobProcessor)iterator.next(); ! expectedRecordsCount=expectedRecordsCount+jobProcessor.getTotalRecordsCount(); ! } ! logger.trace("Entering getExpectedRecordsCount = " + expectedRecordsCount); ! return expectedRecordsCount; } /** ! * Returns the number of records processed so far. This will be ! * the sum of the processed count from all the job processors. ! * ! * @return Returns the count of processed records. */ public int getProcessedRecordsCount() { ! logger.trace("Entering getProcessedRecordsCount"); ! int processedRecordsCount=0; ! ! for(Iterator iterator=this.jobProcessorsMap.values().iterator();iterator.hasNext();) ! { ! BasicJobProcessor jobProcessor=(BasicJobProcessor)iterator.next(); ! processedRecordsCount=processedRecordsCount+jobProcessor.getProcessedRecordsCount(); ! } ! logger.trace("Entering getProcessedRecordsCount = " + processedRecordsCount); ! return processedRecordsCount; } /** ! * Returns the IDs of all the processors as string array. ! * ! * @return Returns the string array consist of all the processor thread IDs. */ public String[] getThreadIDList() { ! logger.trace("Entering getThreadIDList"); ! ! String threadIDList[]=new String[this.jobProcessorsMap.size()]; ! int i=0; ! for(Iterator iterator=this.jobProcessorsMap.keySet().iterator();iterator.hasNext();i++) ! threadIDList[i]=(String)iterator.next(); ! ! logger.trace("Exiting getThreadIDList"); ! return threadIDList; } /** ! * Returns the state of the requested thread as a ThreadState object. */ public ThreadState getThreadState(String threadID) { ! ThreadState state=null; ! if(threadID!=null && this.jobProcessorsMap.containsKey(threadID)) ! { ! BasicJobProcessor jobProcessor=(BasicJobProcessor)this.jobProcessorsMap.get(threadID); ! state=new ThreadState(threadID, "Basic Job Processor", jobProcessor.getProcessorState()); ! } ! else ! { ! state=null; ! } ! logger.trace("Exiting getThreadState = " + state); ! return state; } /** ! * <p> ! * Returns the status of the job. Possible values are... <br> ! * <table> ! * <tr><td><b>Status</b></td></tr> ! * <tr><td>RUNNING</td></tr> ! * <tr><td>SUSPENDED</td></tr> ! * </p> */ public JobStatus getJobStatus() { ! return this.jobStatus; } /** ! * Stops the job by stopping all the job processors. */ public boolean stop() { ! logger.trace("Entering stop"); ! boolean stopped=true; ! ! for(Iterator iterator=this.jobProcessorsMap.values().iterator();iterator.hasNext();) ! { ! BasicJobProcessor jobProcessor=(BasicJobProcessor)iterator.next(); ! boolean processorStopped=jobProcessor.suspend(); ! /** ! * What should we do in case of job processor not being stopped. ! */ ! } ! ! if(stopped) ! this.jobStatus=JobStatus.STOPPED; ! logger.trace("Exiting stop = " + stopped); ! return stopped; } /** ! * Suspends the job by suspending all the job processors. If it couldnt suspend any one of the job processor, ! * it will rollback all the earlier suspends. ! * ! * @return Returns true if it could suspend the job, false otherwise. */ public boolean suspend() { ! logger.trace("Entering suspend"); ! boolean suspended=true; ! ! if(this.jobStatus==JobStatus.RUNNING) ! { ! List suspendedProcessorList=new ArrayList(); ! for(Iterator iterator=this.jobProcessorsMap.values().iterator();iterator.hasNext();) ! { ! BasicJobProcessor jobProcessor=(BasicJobProcessor)iterator.next(); ! boolean processorSuspended=jobProcessor.suspend(); ! if(processorSuspended) ! { ! suspendedProcessorList.add(jobProcessor); ! } ! else ! { ! /** ! * Add to the suspended list... in case to be rolled back rollbck everyone in the suspended list. ! */ ! logger.error("Unable to suspend one of the processor.. So rolling back the changes"); ! suspended=false; ! for(Iterator subIterator=suspendedProcessorList.iterator();subIterator.hasNext();) ! { ! ((BasicJobProcessor)subIterator.next()).resume(); ! } ! break; ! } ! } ! ! if(suspended) ! this.jobStatus=JobStatus.SUSPENDED; ! } ! else ! { ! suspended=false; ! logger.info("Job current status is not RUNNING to suspend"); ! } ! logger.trace("Exiting suspend = " + suspended); ! return suspended; } /** ! * Resumes of the job processing by resuming all the job processors. ! * ! * @return Returns true if job can be resumed, false otherwise. */ public boolean resume() { ! logger.trace("Entering resume"); ! boolean resumed=true; ! ! if(this.jobStatus==JobStatus.SUSPENDED) ! { ! List resumedProcessorList=new ArrayList(); ! for(Iterator iterator=this.jobProcessorsMap.values().iterator();iterator.hasNext();) ! { ! BasicJobProcessor jobProcessor=(BasicJobProcessor)iterator.next(); ! boolean processorResumed=jobProcessor.suspend(); ! if(processorResumed) ! { ! resumedProcessorList.add(jobProcessor); ! } ! else ! { ! /** ! * Add to the resumed list... in case to be rolled back rollbck everyone in the resumed list. ! */ ! logger.error("Unable to resume one of the processor.. So rolling back the changes"); ! resumed=false; ! for(Iterator subIterator=resumedProcessorList.iterator();subIterator.hasNext();) ! { ! ((BasicJobProcessor)subIterator.next()).suspend(); ! } ! break; ! } ! } ! ! if(resumed) ! this.jobStatus=JobStatus.RUNNING; ! } ! else ! { ! resumed=false; ! logger.error("Job is not in SUSPENDED status to resume"); ! } ! logger.trace("Exiting resume = " + resumed); ! return resumed; } *************** *** 228,231 **** --- 380,385 ---- try { + boolean registered=jobProcessor.registerThread(); + logger.debug("Status of registering thread with the processor = " + registered); logger.trace("Going to call the process method"); returnCode=jobProcessor.process(); |
From: Suresh <sur...@us...> - 2006-05-04 22:27:17
|
Update of /cvsroot/batchserver/batchserver/test/org/jmonks/batchserver/framework/controller/basic In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6883 Added Files: BasicJobControllerTest.java TestBasicJobProcessor.java Log Message: no message --- NEW FILE: BasicJobControllerTest.java --- /* * BasicJobControllerTest.java * JUnit based test * * Created on May 4, 2006, 12:51 PM */ package org.jmonks.batchserver.framework.controller.basic; import junit.framework.*; import org.jmonks.batchserver.framework.LoggingManager; import org.jmonks.batchserver.framework.common.ErrorCode; import org.jmonks.batchserver.framework.config.BasicJobControllerConfig; import org.jmonks.batchserver.framework.config.FrameworkConfig; import org.jmonks.batchserver.framework.config.JobConfig; import org.jmonks.batchserver.framework.config.JobConfigFactory; import org.jmonks.batchserver.framework.config.JobLoggingConfig; import org.jmonks.batchserver.framework.controller.JobController; /** * * @author w951h8m */ public class BasicJobControllerTest extends TestCase { public BasicJobControllerTest(String testName) { super(testName); } protected void setUp() throws Exception { } protected void tearDown() throws Exception { } public static Test suite() { //TestSuite suite = new TestSuite(BasicJobControllerTest.class); TestSuite suite=new TestSuite(); suite.addTest(new BasicJobControllerTest("testProcess")); return suite; } /** * Test of process method, of class org.jmonks.batchserver.framework.controller.basic.BasicJobController. */ public void testProcess() { FrameworkConfig frameworkConfig=FrameworkConfig.getInstance(); assertNotNull(frameworkConfig); FrameworkConfig.FrameworkLoggingConfig frameworkLoggingConfig=frameworkConfig.getFrameworkLoggingConfig(); assertNotNull(frameworkLoggingConfig); LoggingManager.initializeFrameworkLogging(frameworkLoggingConfig); FrameworkConfig.JobConfigFactoryConfig factoryConfig=frameworkConfig.getJobConfigFactoryConfig(); assertNotNull(factoryConfig); JobConfigFactory factory=JobConfigFactory.getJobConfigFactory(factoryConfig); assertNotNull(factory); JobConfig jobConfig=factory.getJobConfig("process_file_xyz"); assertNotNull(jobConfig); JobLoggingConfig jobLoggingConfig=jobConfig.getJobLoggingConfig(); assertNotNull(jobLoggingConfig); LoggingManager.initializeJobLogging("process_file_xyz", frameworkLoggingConfig,jobLoggingConfig); BasicJobControllerConfig controllerConfig=(BasicJobControllerConfig)jobConfig.getJobControllerConfig(); assertNotNull(controllerConfig); JobController jobController=JobController.getJobController("process_file_xyz", controllerConfig); assertNotNull(jobController); ErrorCode returnCode=jobController.process(); assertNotNull(returnCode); } /** * Test of getExpectedRecordsCount method, of class org.jmonks.batchserver.framework.controller.basic.BasicJobController. */ public void testGetExpectedRecordsCount() { System.out.println("testGetExpectedRecordsCount"); // TODO add your test code below by replacing the default call to fail. fail("The test case is empty."); } /** * Test of getProcessedRecordsCount method, of class org.jmonks.batchserver.framework.controller.basic.BasicJobController. */ public void testGetProcessedRecordsCount() { System.out.println("testGetProcessedRecordsCount"); // TODO add your test code below by replacing the default call to fail. fail("The test case is empty."); } /** * Test of getThreadIDList method, of class org.jmonks.batchserver.framework.controller.basic.BasicJobController. */ public void testGetThreadIDList() { System.out.println("testGetThreadIDList"); // TODO add your test code below by replacing the default call to fail. fail("The test case is empty."); } /** * Test of getThreadState method, of class org.jmonks.batchserver.framework.controller.basic.BasicJobController. */ public void testGetThreadState() { System.out.println("testGetThreadState"); // TODO add your test code below by replacing the default call to fail. fail("The test case is empty."); } /** * Test of getJobStatus method, of class org.jmonks.batchserver.framework.controller.basic.BasicJobController. */ public void testGetJobStatus() { System.out.println("testGetJobStatus"); // TODO add your test code below by replacing the default call to fail. fail("The test case is empty."); } /** * Test of stop method, of class org.jmonks.batchserver.framework.controller.basic.BasicJobController. */ public void testStop() { System.out.println("testStop"); // TODO add your test code below by replacing the default call to fail. fail("The test case is empty."); } /** * Test of suspend method, of class org.jmonks.batchserver.framework.controller.basic.BasicJobController. */ public void testSuspend() { System.out.println("testSuspend"); // TODO add your test code below by replacing the default call to fail. fail("The test case is empty."); } /** * Test of resume method, of class org.jmonks.batchserver.framework.controller.basic.BasicJobController. */ public void testResume() { System.out.println("testResume"); // TODO add your test code below by replacing the default call to fail. fail("The test case is empty."); } } --- NEW FILE: TestBasicJobProcessor.java --- /* * TestBasicJobProcessor.java * * Created on May 4, 2006, 12:42 PM * * To change this template, choose Tools | Options and locate the template under * the Source Creation and Management node. Right-click the template and choose * Open. You can then make changes to the template in the Source Editor. */ package org.jmonks.batchserver.framework.controller.basic; import org.apache.log4j.Logger; import org.jmonks.batchserver.framework.common.ErrorCode; /** * Test class to be used in JUnits test the basic controller. * * @author Suresh Pragada */ public class TestBasicJobProcessor extends BasicJobProcessor { private static Logger logger=Logger.getLogger(TestBasicJobProcessor.class); /** Creates a new instance of TestBasicJobProcessor */ public TestBasicJobProcessor() { logger.error("TestBasicJobProcessor has been initialized"); } public void cleanup() { logger.error("TestBasicJobProcessor cleanup has been called"); } public int getProcessedCount() { return 10; } public Object getProcessorState() { return "Running"; } public int getTotalCount() { return 20; } public void initialize(java.util.Map configProps) { logger.error("TestBasicJobProcessor initalize has been called"); logger.error("Called with the map = " + configProps); } public ErrorCode process() { try { Thread.currentThread().sleep(3000); } catch(InterruptedException exception) { logger.error(exception.getMessage(),exception); } return ErrorCode.JOB_CONFIGURATION_ERROR; } public boolean resume() { logger.error("TestBasicJobProcessor resume has been called"); return false; } public boolean stop() { logger.error("TestBasicJobProcessor stop has been called"); return false; } public boolean suspend() { logger.error("TestBasicJobProcessor suspend has been called"); return false; } } |
From: Suresh <sur...@us...> - 2006-05-04 22:27:02
|
Update of /cvsroot/batchserver/batchserver/test/org/jmonks/batchserver/framework/controller/basic In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6601a/basic Log Message: Directory /cvsroot/batchserver/batchserver/test/org/jmonks/batchserver/framework/controller/basic added to the repository |
From: Suresh <sur...@us...> - 2006-05-04 22:26:52
|
Update of /cvsroot/batchserver/batchserver/test/org/jmonks/batchserver/framework/controller In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6574/controller Log Message: Directory /cvsroot/batchserver/batchserver/test/org/jmonks/batchserver/framework/controller added to the repository |
From: Suresh <sur...@us...> - 2006-05-04 22:26:30
|
Update of /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/controller In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6466/org/jmonks/batchserver/framework/controller Modified Files: JobController.java Log Message: no message Index: JobController.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/controller/JobController.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** JobController.java 3 May 2006 22:11:18 -0000 1.7 --- JobController.java 4 May 2006 22:26:26 -0000 1.8 *************** *** 66,69 **** --- 66,70 ---- public static synchronized JobController getJobController(String jobName, JobControllerConfig jobControllerConfig) { + logger.trace("Entering getJobController = " + jobName); if(jobController==null) { *************** *** 108,111 **** --- 109,113 ---- } } + logger.trace("Exiting getJobController = " + jobName); return jobController; } |
From: Suresh <sur...@us...> - 2006-05-04 22:26:29
|
Update of /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/controller/basic In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6466/org/jmonks/batchserver/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.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** BasicJobProcessor.java 3 May 2006 22:11:17 -0000 1.5 --- BasicJobProcessor.java 4 May 2006 22:26:26 -0000 1.6 *************** *** 5,32 **** /** * <p> ! * This is the basic job processor. This interface lets the developers to extend this interface and implement their logic. * </p> * ! * @author : Suresh Pragada * @version 1.0 */ ! public interface BasicJobProcessor { ! public boolean suspend(); ! ! public boolean resume(); ! ! public boolean stop(); ! ! public void initialize(Map configProps); ! ! public ErrorCode process(); ! ! public void cleanup(); ! ! public Object getProcessorState(); ! public int getTotalCount(); ! public int getProcessedCount(); } --- 5,119 ---- /** * <p> ! * BasicJobProcessor lets developers implement their business logic. * </p> * ! * @author Suresh Pragada * @version 1.0 + * @since 1.0 */ ! public abstract class BasicJobProcessor { ! /** ! * <p> ! * Basic job controller calls this method to suspend the job processor, when it receives ! * a <i>suspsend</i> message from the managemet interface. Default implementation ! * will suspend the job processor abruptly as soon as it receives the message. ! * Implementors can provide their own implementation by overriding this method ! * to provide better mechanism. ! * </p> ! * ! * @return Returns true if processor has suspended, false otherwise. ! */ ! public boolean suspend() ! { ! return true; ! } ! /** ! * <p> ! * Basic job controller calls this method to resume the job processor, when it receives ! * a <i>resume</i> message from the managemet interface. Default implementation ! * will resume the job processor abruptly as soon as it receives the message. ! * Implementors can provide their own implementation by overriding this method ! * to provide better mechanism. ! * </p> ! * ! * @return Returns true if processor has resumed, false otherwise. ! */ ! public boolean resume() ! { ! return true; ! } ! /** ! * <p> ! * Basic job controller calls this method to stop the job processor, when it receives ! * a <i>stop</i> message from the managemet interface. Default implementation ! * will stop the job processor abruptly as soon as it receives the message. ! * Implementors can provide their own implementation by overriding this method ! * to provide better mechanism. ! * </p> ! * ! * @return Returns true if processor has stopped, false otherwise. ! */ ! public boolean stop() ! { ! return true; ! } ! /** ! * <p> ! * This method gets a chance to initialize the job processor. This will be called ! * before the <i>process</i> method being called. Properties configured for ! * job processor in job configuration will be passed as map to this method. ! * If job processor needs any resources, they can initialize them here. If ! * mulitple job processors have been configured, this method will be called ! * for each processor in the order they will be created. ! * </p> ! * ! * @param configProps Properties defined for job processor in the job configuration. ! */ ! public abstract void initialize(Map configProps); ! /** ! * <p> ! * This method let developer implement businses logic and return the appropriate ! * error code. ! * </p> ! * ! * @return Returns the appropriate error code needs to be passed to the invocation layer. ! */ ! public abstract ErrorCode process(); ! ! /** ! * <p> ! * This method gets a chance to do any cleanup if needed, after the ! * <i>process</i> method finished. This will be called irrespective of the ! * return status(even exceptions occured) of the <i>process</i> method. ! * </p> ! */ ! public abstract void cleanup(); ! ! /** ! * This is for monitoring applications to know the exact state of this particular ! * (if there are multiple job processors) job processor. This can return any object ! * which can be converted to display. ! * ! * @return Returns the exact state this processor. ! */ ! public abstract Object getProcessorState(); ! ! /** ! * This is for monitoring applications to know how many records this particular ! * (if there are multiple job processors) job processor is going to process. ! * ! * @return Returns the number of records/jobs this processor is going to process. ! */ ! public abstract int getTotalCount(); ! ! /** ! * This is for monitoring applications to know how many records this particular ! * (if there are multiple job processors) job processor has finished processing. ! * ! * @return Returns the number of records/jobs this processor has finished processing. ! */ ! public abstract int getProcessedCount(); } Index: BasicJobController.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/controller/basic/BasicJobController.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** BasicJobController.java 3 May 2006 22:11:17 -0000 1.6 --- BasicJobController.java 4 May 2006 22:26:26 -0000 1.7 *************** *** 1,4 **** --- 1,6 ---- package org.jmonks.batchserver.framework.controller.basic; + import EDU.oswego.cs.dl.util.concurrent.Callable; import EDU.oswego.cs.dl.util.concurrent.CountDown; + import EDU.oswego.cs.dl.util.concurrent.FutureResult; import java.util.HashMap; import java.util.Hashtable; *************** *** 15,19 **** /** * <p> ! * This is the basic implementation of Job Controller. * </p> * --- 17,23 ---- /** * <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> * *************** *** 56,59 **** --- 60,64 ---- public ErrorCode process() { + logger.info("Entering process in basic job controller = " + super.getJobName()); BasicJobControllerConfig basicJobControllerConfig=(BasicJobControllerConfig)super.getJobControllerConfig(); int threadCount=basicJobControllerConfig.getBasicJobProcessThreadCount(); *************** *** 63,68 **** --- 68,75 ---- threadCount=threadCount>0?threadCount:0; CountDown countDownLock=new CountDown(threadCount); + logger.debug("Going to create " + threadCount + " basic job processor(s)"); for(int i=0;i<threadCount;i++) { + String threadID=super.getJobName()+"_"+(i+1); BasicJobProcessor jobProcessor=this.getBasicJobProcessor(basicJobControllerConfig.getBasicJobProcessorClassName()); /** *************** *** 72,88 **** try { jobProcessor.initialize(processorConfigProperties); } catch(Throwable exception) { exception.printStackTrace(); ! logger.error(exception.getMessage(), exception); } ! String threadID=super.getJobName()+"_"+(i+1); ! Thread thread=new Thread(this.getRunnableProcessor(countDownLock,jobProcessor), threadID); ! thread.start(); this.jobProcessorsMap.put(threadID,jobProcessor); } ! return hybernate(countDownLock); } --- 79,102 ---- try { + logger.debug("Going to initialize the " + threadID + " basic job processor"); jobProcessor.initialize(processorConfigProperties); + logger.info("Done initializing the " + threadID + " basic job processor"); } catch(Throwable exception) { exception.printStackTrace(); ! logger.error("Exception while initializing the " + threadID + " basic job processor = " + ! exception.getMessage(), exception); } ! FutureResult result=new FutureResult(); ! Thread processorThread=new Thread(result.setter(this.getCallableProcessor(countDownLock,jobProcessor)), threadID); ! processorThread.start(); this.jobProcessorsMap.put(threadID,jobProcessor); + this.jobProcessorsResultMap.put(threadID, result); + logger.info(threadID + " basic job processor has been kicked off."); } ! ErrorCode returnCode=hybernate(countDownLock); ! logger.info("Exiting process in basic job controller = " + super.getJobName() + " with return code = " + returnCode); ! return returnCode; } *************** *** 165,168 **** --- 179,183 ---- private BasicJobProcessor getBasicJobProcessor(String basicJobProcessorClassName) { + logger.trace("Entering getBasicJobProcessor = " + basicJobProcessorClassName); BasicJobProcessor jobProcessor=null; try *************** *** 188,191 **** --- 203,207 ---- throw new ConfigurationException(ConfigurationException.JOB_CONTROLLER_CONFIG, exception.getMessage()); } + logger.trace("Exiting getBasicJobProcessor"); return jobProcessor; } *************** *** 203,257 **** * @return Returns the runnable instance. */ ! private Runnable getRunnableProcessor(final CountDown countDownLock,final BasicJobProcessor jobProcessor) { ! Runnable runnable=new Runnable(){ ! public void run() { ! /** ! * Call the process method on basic job processor and report the er. ! */ try { ! ErrorCode errorCode=jobProcessor.process(); ! done(Thread.currentThread().getName(),errorCode); } catch(Throwable exception) { exception.printStackTrace(); ! logger.error(exception.getMessage(), exception); ! done(Thread.currentThread().getName(), ErrorCode.BASIC_JOB_PROCESSOR_EXCEPTION); } ! /** ! * Call the cleanup method on basic job processor. ! */ try { jobProcessor.cleanup(); } catch(Throwable exception) { exception.printStackTrace(); ! logger.error(exception.getMessage(), exception); } countDownLock.release(); } }; ! return runnable; } - - /** - * <p> - * Once all the processors have done their task, they will report here with the - * errorcode. This API will registers the errorcode with the thread name and - * wakes up the main thread if this is the last processor. - * </p> - * @param threadID Name of thread done and reporting. - * @param errorCode Processor return code. - */ - private void done(String threadID,ErrorCode errorCode) - { - this.jobProcessorsResultMap.put(threadID, errorCode); - logger.info(threadID + " has finished processing with the error code = " + errorCode); - } /** --- 219,261 ---- * @return Returns the runnable instance. */ ! private Callable getCallableProcessor(final CountDown countDownLock,final BasicJobProcessor jobProcessor) { ! logger.trace("Entering getCallableProcessor"); ! Callable callable=new Callable(){ ! public Object call() { ! ErrorCode returnCode=null; try { ! logger.trace("Going to call the process method"); ! returnCode=jobProcessor.process(); ! logger.debug("Done calling the process method"); } catch(Throwable exception) { exception.printStackTrace(); ! logger.error("Exception while processing = " + exception.getMessage(), exception); ! returnCode=ErrorCode.BASIC_JOB_PROCESSOR_EXCEPTION; } ! // Need to call the processor cleanup all the time. try { + logger.trace("Going to call cleanup method"); jobProcessor.cleanup(); + logger.debug("Done calling the cleanup method"); } catch(Throwable exception) { exception.printStackTrace(); ! logger.error("Exception while doing the cleanup = " + exception.getMessage(), exception); } countDownLock.release(); + logger.info(Thread.currentThread().getName() + " is exiting with the error code = " + returnCode); + return returnCode; } }; ! logger.trace("Exiting getCallableProcessor"); ! return callable; } /** *************** *** 267,287 **** private ErrorCode hybernate(CountDown countDownLock) { try { countDownLock.acquire(); } catch(InterruptedException exception) { exception.printStackTrace(); ! logger.error(exception.getMessage(), exception); } for(Iterator iterator=this.jobProcessorsResultMap.values().iterator();iterator.hasNext();) { ! ErrorCode returnCode=(ErrorCode)iterator.next(); ! if(returnCode!=ErrorCode.JOB_COMPLETED_SUCCESSFULLY) ! return returnCode; } ! return ErrorCode.JOB_COMPLETED_SUCCESSFULLY; } } --- 271,300 ---- private ErrorCode hybernate(CountDown countDownLock) { + logger.trace("Entering hybernate"); + ErrorCode returnCode=ErrorCode.JOB_COMPLETED_SUCCESSFULLY; try { + logger.debug("Going to wait until all the processors is gonna finish."); countDownLock.acquire(); + logger.info("All processors have finished their task."); } catch(InterruptedException exception) { exception.printStackTrace(); ! logger.error("Exception while waiting for all the processors = " + exception.getMessage(), exception); ! return ErrorCode.BASIC_JOB_PROCESSOR_EXCEPTION; } for(Iterator iterator=this.jobProcessorsResultMap.values().iterator();iterator.hasNext();) { ! ErrorCode threadReturnCode=(ErrorCode)((FutureResult)iterator.next()).peek(); ! if(threadReturnCode!=ErrorCode.JOB_COMPLETED_SUCCESSFULLY) ! { ! returnCode=threadReturnCode; ! break; ! } } ! logger.trace("Exiting hybernate = " + returnCode); ! return returnCode; } } |
From: Suresh <sur...@us...> - 2006-05-04 22:26:29
|
Update of /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/config/xml In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6466/org/jmonks/batchserver/framework/config/xml Modified Files: batch-config.xml Log Message: no message Index: batch-config.xml =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/config/xml/batch-config.xml,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** batch-config.xml 14 Mar 2006 23:05:25 -0000 1.5 --- batch-config.xml 4 May 2006 22:26:26 -0000 1.6 *************** *** 20,24 **** <job-config job-name="process_file_xyz" job-status="active"> <job-controller job-controller-class-name="org.jmonks.batchserver.framework.controller.basic.BasicJobController"> ! <basic-job-processor basic-job-processor-class-name="com.mycompany.batch.processfilexyz.XyzProcessor" thread-count="2"> <property key="basic-job-processor-key1">processor-value1</property> </basic-job-processor> --- 20,24 ---- <job-config job-name="process_file_xyz" job-status="active"> <job-controller job-controller-class-name="org.jmonks.batchserver.framework.controller.basic.BasicJobController"> ! <basic-job-processor basic-job-processor-class-name="org.jmonks.batchserver.framework.controller.basic.TestBasicJobProcessor" thread-count="5"> <property key="basic-job-processor-key1">processor-value1</property> </basic-job-processor> *************** *** 26,31 **** </job-controller> <job-logging-config> ! <job-logger-config logger-name="com.mycompany.batch.xyz" logger-level="DEBUG"/> ! <job-logger-config logger-name="com.mycompany.batch.abc.processor" logger-level="ERROR"/> <job-logger-config logger-name="org.jmonks.batchserver.framework" logger-level="ERROR"/> </job-logging-config> --- 26,30 ---- </job-controller> <job-logging-config> ! <job-logger-config logger-name="org.jmonks.batchserver.framework.controller.basic" logger-level="TRACE"/> <job-logger-config logger-name="org.jmonks.batchserver.framework" logger-level="ERROR"/> </job-logging-config> |
From: Suresh <sur...@us...> - 2006-05-03 22:11:22
|
Update of /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/management In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9605/org/jmonks/batchserver/framework/management Modified Files: JobManager.java JobManagerMBean.java Log Message: no message Index: JobManager.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/management/JobManager.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** JobManager.java 5 Apr 2006 22:22:48 -0000 1.2 --- JobManager.java 3 May 2006 22:11:18 -0000 1.3 *************** *** 43,56 **** /** ! * Controller should stop its processing as soon this method call has been ! * received. If the restart flag is true, it persist the controller to the repository. ! * ! * @param restart Tells whether job needs to be restarted or not. * ! * @return Returns whether job can be stopped or not. */ ! public boolean stop(boolean restart) { ! return this.jobManager.stop(restart) ; } --- 43,53 ---- /** ! * Controller should stop its processing as soon this method call has been received. * ! * @return Returns whether job has been stopped or not. */ ! public boolean stop() { ! return this.jobManager.stop() ; } Index: JobManagerMBean.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/management/JobManagerMBean.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** JobManagerMBean.java 28 Mar 2006 04:55:18 -0000 1.2 --- JobManagerMBean.java 3 May 2006 22:11:18 -0000 1.3 *************** *** 22,32 **** /** ! * Controller should stop its processing as soon this method call has been received. If the restart flag is true, it persist the controller to the repository. ! * ! * @param restart Tells whether job needs to be restarted or not. * ! * @return Returns whether job can be stopped or not. */ ! public boolean stop(boolean restart); /** --- 22,30 ---- /** ! * Controller should stop its processing as soon this method call has been received. * ! * @return Returns whether job has been stopped or not. */ ! public boolean stop(); /** |
From: Suresh <sur...@us...> - 2006-05-03 22:11:22
|
Update of /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/controller/basic In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9605/org/jmonks/batchserver/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.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** BasicJobProcessor.java 3 May 2006 13:01:49 -0000 1.4 --- BasicJobProcessor.java 3 May 2006 22:11:17 -0000 1.5 *************** *** 30,33 **** public int getProcessedCount(); - } --- 30,32 ---- Index: BasicJobController.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/controller/basic/BasicJobController.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** BasicJobController.java 3 May 2006 13:01:49 -0000 1.5 --- BasicJobController.java 3 May 2006 22:11:17 -0000 1.6 *************** *** 1,5 **** --- 1,15 ---- package org.jmonks.batchserver.framework.controller.basic; + import EDU.oswego.cs.dl.util.concurrent.CountDown; + import java.util.HashMap; + import java.util.Hashtable; + import java.util.Iterator; + import java.util.Map; + import org.apache.log4j.Logger; import org.jmonks.batchserver.framework.common.ErrorCode; + import org.jmonks.batchserver.framework.config.BasicJobControllerConfig; + import org.jmonks.batchserver.framework.config.ConfigurationException; import org.jmonks.batchserver.framework.controller.JobController; + import org.jmonks.batchserver.framework.management.JobStatus; + import org.jmonks.batchserver.framework.management.ThreadState; /** *************** *** 12,26 **** * @since 1.0 */ ! public class BasicJobController extends JobController { ! ! private BasicJobProcessor basicJobProcessor; public BasicJobController() { } public ErrorCode process() { ! return null; } --- 22,88 ---- * @since 1.0 */ ! public class BasicJobController extends JobController ! { ! /** ! * Map holds all the basic job processors being used for the given job as values and ! * name of the threads as keys. ! */ ! private Map jobProcessorsMap=new Hashtable(); ! /** ! * Map holds all the basic job processors returned error codes as values and ! * name of the threads as keys. ! */ ! private Map jobProcessorsResultMap=new Hashtable(); + private static Logger logger=Logger.getLogger(BasicJobController.class); + /** + * Constructor enables the instantiation of the basic job controller instance. + */ public BasicJobController() { } + /** + * <p> + * Executes the job by running the configured number of basic job processors + * and returns the appropriate errorcode. It collects all the return codes returned + * by job processors and return the first non successful return code it found in the + * list. If it doesnt find any non successful return code, it will return successful + * error code. + * </p> + * + * @return Returns the processing error code for the job. + */ public ErrorCode process() { ! BasicJobControllerConfig basicJobControllerConfig=(BasicJobControllerConfig)super.getJobControllerConfig(); ! int threadCount=basicJobControllerConfig.getBasicJobProcessThreadCount(); ! /** ! * If thread count is not greater than zero.. set it as 0 ! */ ! threadCount=threadCount>0?threadCount:0; ! CountDown countDownLock=new CountDown(threadCount); ! for(int i=0;i<threadCount;i++) ! { ! BasicJobProcessor jobProcessor=this.getBasicJobProcessor(basicJobControllerConfig.getBasicJobProcessorClassName()); ! /** ! * Make seperate copy of property map for each processor and initialize with that map. ! */ ! Map processorConfigProperties=new HashMap(basicJobControllerConfig.getBasicJobProcessorConfigProperties()); ! try ! { ! jobProcessor.initialize(processorConfigProperties); ! } ! catch(Throwable exception) ! { ! exception.printStackTrace(); ! logger.error(exception.getMessage(), exception); ! } ! String threadID=super.getJobName()+"_"+(i+1); ! Thread thread=new Thread(this.getRunnableProcessor(countDownLock,jobProcessor), threadID); ! thread.start(); ! this.jobProcessorsMap.put(threadID,jobProcessor); ! } ! return hybernate(countDownLock); } *************** *** 28,32 **** * Returns the total number of records. * ! * @return Returns the total number of records the job gonna process. */ public int getExpectedRecordsCount() --- 90,94 ---- * Returns the total number of records. * ! * @return Returns the total number of records the job going to process. */ public int getExpectedRecordsCount() *************** *** 36,40 **** /** ! * Returns the numebr of records processed so far. */ public int getProcessedRecordsCount() --- 98,102 ---- /** ! * Returns the number of records processed so far. */ public int getProcessedRecordsCount() *************** *** 46,50 **** * Returns the thread count. */ ! public java.lang.String[] getThreadIDList() { return null; --- 108,112 ---- * Returns the thread count. */ ! public String[] getThreadIDList() { return null; *************** *** 54,58 **** * Returns the state of the thread as a ThreadState object. */ ! public org.jmonks.batchserver.framework.management.ThreadState getThreadState(String threadID) { return null; --- 116,120 ---- * Returns the state of the thread as a ThreadState object. */ ! public ThreadState getThreadState(String threadID) { return null; *************** *** 62,66 **** * Returns the job status. */ ! public org.jmonks.batchserver.framework.management.JobStatus getJobStatus() { return null; --- 124,128 ---- * Returns the job status. */ ! public JobStatus getJobStatus() { return null; *************** *** 68,74 **** /** ! * Stops the job and persist the state of this job, if restart flag is true. */ ! public boolean stop(boolean restart) { return true; --- 130,136 ---- /** ! * Stops the job. */ ! public boolean stop() { return true; *************** *** 90,92 **** --- 152,287 ---- return true; } + + /** + * Instantiates and returns the basic job processor using the given class name. + * The given class name should implement the BasicJobProcessor interface. + * + * @param basicJobProcessorClassName Class name that implements the BasicJobProcessor interface. + * + * @return Returns the baic job processor instance. + * + * @throws ConfigurationException If it couldnt instantiate basic job processor instance. + */ + private BasicJobProcessor getBasicJobProcessor(String basicJobProcessorClassName) + { + BasicJobProcessor jobProcessor=null; + try + { + jobProcessor=(BasicJobProcessor)Class.forName(basicJobProcessorClassName).newInstance(); + } + catch(ClassNotFoundException exception) + { + exception.printStackTrace(); + logger.error(exception.getMessage(),exception); + throw new ConfigurationException(ConfigurationException.JOB_CONTROLLER_CONFIG, exception.getMessage()); + } + catch(InstantiationException exception) + { + exception.printStackTrace(); + logger.error(exception.getMessage(),exception); + throw new ConfigurationException(ConfigurationException.JOB_CONTROLLER_CONFIG, exception.getMessage()); + } + catch(IllegalAccessException exception) + { + exception.printStackTrace(); + logger.error(exception.getMessage(),exception); + throw new ConfigurationException(ConfigurationException.JOB_CONTROLLER_CONFIG, exception.getMessage()); + } + return jobProcessor; + } + + /** + * <p> + * Creates the runnable object by encapsulating the given job processor and + * kick off the process method on the processor. Once processor has finsihed + * its processing reports the error code to the controller by calling the "done" + * method on the controller. + * </p> + * @param countDownLock CountDown object to release when the processing has been done. + * @param jobProcessor Initialized Basic job processor instance. + * + * @return Returns the runnable instance. + */ + private Runnable getRunnableProcessor(final CountDown countDownLock,final BasicJobProcessor jobProcessor) + { + Runnable runnable=new Runnable(){ + public void run() + { + /** + * Call the process method on basic job processor and report the er. + */ + try + { + ErrorCode errorCode=jobProcessor.process(); + done(Thread.currentThread().getName(),errorCode); + } + catch(Throwable exception) + { + exception.printStackTrace(); + logger.error(exception.getMessage(), exception); + done(Thread.currentThread().getName(), ErrorCode.BASIC_JOB_PROCESSOR_EXCEPTION); + } + /** + * Call the cleanup method on basic job processor. + */ + try + { + jobProcessor.cleanup(); + } + catch(Throwable exception) + { + exception.printStackTrace(); + logger.error(exception.getMessage(), exception); + } + countDownLock.release(); + } + }; + return runnable; + } + + /** + * <p> + * Once all the processors have done their task, they will report here with the + * errorcode. This API will registers the errorcode with the thread name and + * wakes up the main thread if this is the last processor. + * </p> + * @param threadID Name of thread done and reporting. + * @param errorCode Processor return code. + */ + private void done(String threadID,ErrorCode errorCode) + { + this.jobProcessorsResultMap.put(threadID, errorCode); + logger.info(threadID + " has finished processing with the error code = " + errorCode); + } + + /** + * <p> + * Main thread will call this method and wait until all the processors have + * finished their processing. Once they are finished, all the return codes + * will be analyzed and one error code will be returned for this job. + * </p + * @param countDownLock CountDown lock being used by all the processors. + * + * @return Returns the error code of the job. + */ + private ErrorCode hybernate(CountDown countDownLock) + { + try + { + countDownLock.acquire(); + } + catch(InterruptedException exception) + { + exception.printStackTrace(); + logger.error(exception.getMessage(), exception); + } + + for(Iterator iterator=this.jobProcessorsResultMap.values().iterator();iterator.hasNext();) + { + ErrorCode returnCode=(ErrorCode)iterator.next(); + if(returnCode!=ErrorCode.JOB_COMPLETED_SUCCESSFULLY) + return returnCode; + } + return ErrorCode.JOB_COMPLETED_SUCCESSFULLY; + } } |
From: Suresh <sur...@us...> - 2006-05-03 22:11:22
|
Update of /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9605/org/jmonks/batchserver/framework/common Modified Files: ErrorCode.java Log Message: no message Index: ErrorCode.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/common/ErrorCode.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** ErrorCode.java 28 Mar 2006 04:53:23 -0000 1.13 --- ErrorCode.java 3 May 2006 22:11:18 -0000 1.14 *************** *** 89,91 **** --- 89,93 ---- public static final ErrorCode JOB_CONTROLLER_CONFIGURATION_ERROR = new ErrorCode(1005,"Job controller configuration is not defined properly."); + public static final ErrorCode BASIC_JOB_PROCESSOR_EXCEPTION = new ErrorCode(1006,"Controller caught exception while executing process method on basic job processor."); + } |
From: Suresh <sur...@us...> - 2006-05-03 22:11:21
|
Update of /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/controller/pool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9605/org/jmonks/batchserver/framework/controller/pool Modified Files: PoolJobController.java Log Message: no message Index: PoolJobController.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/controller/pool/PoolJobController.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** PoolJobController.java 3 May 2006 13:01:49 -0000 1.5 --- PoolJobController.java 3 May 2006 22:11:18 -0000 1.6 *************** *** 137,141 **** * This calls the stop method on the loader processor and persists the loader, pool and processor, if restart flag is true and return with appropriate return code. */ ! public boolean stop(boolean restart) { --- 137,141 ---- * This calls the stop method on the loader processor and persists the loader, pool and processor, if restart flag is true and return with appropriate return code. */ ! public boolean stop() { |
From: Suresh <sur...@us...> - 2006-05-03 22:11:21
|
Update of /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/controller In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9605/org/jmonks/batchserver/framework/controller Modified Files: JobController.java Log Message: no message Index: JobController.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/controller/JobController.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** JobController.java 3 May 2006 13:01:49 -0000 1.6 --- JobController.java 3 May 2006 22:11:18 -0000 1.7 *************** *** 154,158 **** /** ! * This method will be called by Main to process the job. This returns the exit status of the job, which will be communicate to everyone. * * @return Returns the exit status of the job. --- 154,159 ---- /** ! * This method will be called by Main to process the job. ! * This returns the exit status of the job, which will be communicate to everyone. * * @return Returns the exit status of the job. |
From: Suresh <sur...@us...> - 2006-05-03 13:01:54
|
Update of /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/controller/basic In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32745/org/jmonks/batchserver/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.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** BasicJobProcessor.java 28 Mar 2006 04:54:11 -0000 1.3 --- BasicJobProcessor.java 3 May 2006 13:01:49 -0000 1.4 *************** *** 31,34 **** public int getProcessedCount(); - public boolean isRestartable(); } --- 31,33 ---- Index: BasicJobController.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/controller/basic/BasicJobController.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** BasicJobController.java 28 Mar 2006 04:54:11 -0000 1.4 --- BasicJobController.java 3 May 2006 13:01:49 -0000 1.5 *************** *** 90,117 **** return true; } - - /** - * @see org.jmonks.batchserver.framework.controller.JobController#readObject(ObjectInputStream) - */ - public void readObject(java.io.ObjectInputStream inputStream) - { - } - - /** - * @see org.jmonks.batchserver.framework.controller.JobController#writeObject(ObjectOutputStream) - */ - public void writeObject(java.io.ObjectOutputStream outputStream) - { - } - - /** - * Tells whether the job writting using this controller can be restarted or not. - * This requests the restartable information from the basic job processor implementation. - * - * @return Returns true, if job processor can be restartable, false, otherwise. - */ - public boolean isRestartable() - { - return this.basicJobProcessor.isRestartable(); - } } --- 90,92 ---- |
From: Suresh <sur...@us...> - 2006-05-03 13:01:54
|
Update of /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/controller In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32745/org/jmonks/batchserver/framework/controller Modified Files: JobController.java Log Message: no message Index: JobController.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/controller/JobController.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** JobController.java 28 Mar 2006 04:53:58 -0000 1.5 --- JobController.java 3 May 2006 13:01:49 -0000 1.6 *************** *** 158,184 **** * @return Returns the exit status of the job. */ ! public abstract ErrorCode process(); ! ! /** ! * This method would enable the controller to deserialize its state from the repository. ! * ! * @param inputStream Stream from which the controller needs to be recovered. ! */ ! public abstract void readObject(ObjectInputStream inputStream); ! ! /** ! * This method enables the controller to persist/serializes on its own. ! * ! * @param outputStream Persist/Serialize the state of the controller. ! */ ! public abstract void writeObject(ObjectOutputStream outputStream); ! ! /** ! * Tells whether this controller can be restartable. Specialized controllers ! * collect this information from the specialized jobs. ! * ! * @return Returns true, if controller can be restarted, false, otherwise. ! */ ! public abstract boolean isRestartable(); ! } --- 158,161 ---- * @return Returns the exit status of the job. */ ! public abstract ErrorCode process(); } |
From: Suresh <sur...@us...> - 2006-05-03 13:01:53
|
Update of /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/controller/pool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32745/org/jmonks/batchserver/framework/controller/pool Modified Files: PoolJobController.java Log Message: no message Index: PoolJobController.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/controller/pool/PoolJobController.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** PoolJobController.java 28 Mar 2006 04:54:21 -0000 1.4 --- PoolJobController.java 3 May 2006 13:01:49 -0000 1.5 *************** *** 167,190 **** } - - /** - * @see org.jmonks.batchserver.framework.controller.JobController#readObject(ObjectInputStream) - */ - public void readObject(java.io.ObjectInputStream inputStream) - { - } - - /** - * @see org.jmonks.batchserver.framework.controller.JobController#writeObject(ObjectOutputStream) - */ - public void writeObject(java.io.ObjectOutputStream outputStream) - { - } - - public boolean isRestartable() - { - return true; - } - - } --- 167,169 ---- |
From: Suresh <sur...@us...> - 2006-04-25 13:07:13
|
Update of /cvsroot/batchserver/batchserver/test/org/jmonks/batchserver/framework/config In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1226/org/jmonks/batchserver/framework/config Modified Files: FrameworkConfigTest.java Log Message: no message Index: FrameworkConfigTest.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/test/org/jmonks/batchserver/framework/config/FrameworkConfigTest.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** FrameworkConfigTest.java 14 Mar 2006 23:10:48 -0000 1.4 --- FrameworkConfigTest.java 25 Apr 2006 13:06:49 -0000 1.5 *************** *** 116,123 **** FrameworkConfig frameworkConfig=FrameworkConfig.getInstance(); assertNotNull(frameworkConfig); ! FrameworkConfig.MgmtMntrConfig mmConfig=frameworkConfig.getMgmtMntrConfig(); assertNotNull(mmConfig); ! assertNotNull(mmConfig.getMgmtMntrClassName()); ! assertNotNull(mmConfig.getMgmtMntrProperties()); System.out.println(mmConfig); } --- 116,123 ---- FrameworkConfig frameworkConfig=FrameworkConfig.getInstance(); assertNotNull(frameworkConfig); ! FrameworkConfig.JobConnectorConfig mmConfig=frameworkConfig.getJobConnectorConfig(); assertNotNull(mmConfig); ! assertNotNull(mmConfig.getJobConnectorHelperClassName()); ! assertNotNull(mmConfig.getJobConnectorConfigProperties()); System.out.println(mmConfig); } |
From: Suresh <sur...@us...> - 2006-04-25 13:07:13
|
Update of /cvsroot/batchserver/batchserver/test/org/jmonks/batchserver/framework/mgmtmntr In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1226/org/jmonks/batchserver/framework/mgmtmntr Modified Files: JobStatusTest.java Log Message: no message Index: JobStatusTest.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/test/org/jmonks/batchserver/framework/mgmtmntr/JobStatusTest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** JobStatusTest.java 22 Mar 2006 14:23:34 -0000 1.1 --- JobStatusTest.java 25 Apr 2006 13:06:49 -0000 1.2 *************** *** 9,12 **** --- 9,13 ---- import junit.framework.*; + import org.jmonks.batchserver.framework.management.JobStatus; /** |
From: Suresh <sur...@us...> - 2006-04-25 13:07:13
|
Update of /cvsroot/batchserver/batchserver/test/org/jmonks/batchserver/framework/common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1226/org/jmonks/batchserver/framework/common Modified Files: ErrorCodeTest.java Log Message: no message Index: ErrorCodeTest.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/test/org/jmonks/batchserver/framework/common/ErrorCodeTest.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ErrorCodeTest.java 13 Mar 2006 14:31:15 -0000 1.4 --- ErrorCodeTest.java 25 Apr 2006 13:06:49 -0000 1.5 *************** *** 12,16 **** /** * Test cases to test the ErrorCode.java. ! * * @author Suresh Pragada */ --- 12,16 ---- /** * Test cases to test the ErrorCode.java. ! * * @author Suresh Pragada */ |