[Batchserver-cvs] batchserver/src/org/jmonks/batchserver/framework/controller/pool CollectionJobPool
Brought to you by:
suresh_pragada
From: Suresh <sur...@us...> - 2006-05-15 03:29:36
|
Update of /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/controller/pool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv28607 Modified Files: CollectionJobPool.java JobPool.java Log Message: no message Index: JobPool.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/controller/pool/JobPool.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** JobPool.java 14 May 2006 01:31:32 -0000 1.3 --- JobPool.java 15 May 2006 03:29:32 -0000 1.4 *************** *** 51,59 **** */ 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(); } --- 51,53 ---- Index: CollectionJobPool.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/controller/pool/CollectionJobPool.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** CollectionJobPool.java 14 May 2006 04:36:44 -0000 1.4 --- CollectionJobPool.java 15 May 2006 03:29:32 -0000 1.5 *************** *** 46,53 **** protected int loadedJobsCount=0; /** - * Holds the number of job data objects have been served to job processors. - */ - protected int processedJobsCount=0; - /** * Object to be pushed to the bounded buffer to denote the end of the pool. */ --- 46,49 ---- *************** *** 62,66 **** { } ! public boolean loadJobData(Object jobData) { --- 58,64 ---- { } ! /** ! * @see org.jmonks.batchserver.framework.controller.pool.JobPool#loadJobData(Object) ! */ public boolean loadJobData(Object jobData) { *************** *** 70,81 **** try { ! if(jobData==null) ! jobData=END_OF_POOL; ! this.pool.put(jobData); ! loaded=true; ! this.loadedJobsCount++; } catch(InterruptedException exception) { logger.info("Got exception while loading the job data = " + jobData, exception); } --- 68,92 ---- try { ! if(jobData!=null) ! { ! this.pool.put(jobData); ! /** END_OF_POOL will be loaded by getNextJobData API to wake up other processors */ ! if(jobData!=END_OF_POOL) ! this.loadedJobsCount++; ! } ! else ! { ! /** ! * null from loader indicates that he has done loading with the job data. ! * Push END_OF_POOL to the pool to let processors know that loader is done loading the jobs. ! */ ! this.pool.put(END_OF_POOL); ! System.out.println(Thread.currentThread().getName() + "Pushing end of pool"); ! } ! loaded=true; } catch(InterruptedException exception) { + exception.printStackTrace(); logger.info("Got exception while loading the job data = " + jobData, exception); } *************** *** 83,87 **** return loaded; } ! public Object getNextJobData() { --- 94,100 ---- return loaded; } ! /** ! * @see org.jmonks.batchserver.framework.controller.pool.JobPool#getNextJobData ! */ public Object getNextJobData() { *************** *** 90,103 **** { jobData=this.pool.take(); if(jobData==END_OF_POOL) { this.pool.put(END_OF_POOL); jobData=null; } - else - this.processedJobsCount++; } catch(InterruptedException exception) { logger.info("Got exception while getting the job data from pool", exception); } --- 103,120 ---- { jobData=this.pool.take(); + /** + * If retrieved job data is END_OF_POOL object return null to caller as per + * method contract and put EN_OF_POOL back to the pool to wake up other processors. + */ if(jobData==END_OF_POOL) { + System.out.println(Thread.currentThread().getName() + "Received end of pool"); this.pool.put(END_OF_POOL); jobData=null; } } catch(InterruptedException exception) { + exception.printStackTrace(); logger.info("Got exception while getting the job data from pool", exception); } *************** *** 107,111 **** /** * 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. --- 124,128 ---- /** * Initializes the collection job pool using the configuration defined ! * in the job configuration. It gets 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. *************** *** 127,130 **** --- 144,149 ---- { poolSize=Integer.parseInt(poolSizePropertyValue); + // if(poolSize<1) + // poolSize=CollectionJobPool.DEFAULT_COLLECTION_POOL_SIZE; } catch(Exception exception) *************** *** 151,162 **** } public int getLoadedCount() { return this.loadedJobsCount; } - - public int getProcessedCount() - { - return this.processedJobsCount; - } } --- 170,179 ---- } + /** + * @see org.jmonks.batchserver.framework.controller.pool.JobPool#getLoadedCount + */ public int getLoadedCount() { return this.loadedJobsCount; } } |