1 package net.javacoding.jspider.api.event.monitor; 2 3 6 public class SchedulerMonitorEvent extends MonitorEvent { 7 8 protected int jobCount; 9 protected int spiderJobsCount; 10 protected int thinkerJobsCount; 11 protected int jobsDone; 12 protected int spiderJobsDone; 13 protected int thinkerJobsDone; 14 protected int blockedCount; 15 protected int assignedCount; 16 17 public SchedulerMonitorEvent ( int jobCount, int spiderJobsCount, int thinkerJobsCount, int jobsDone, int spiderJobsDone, int thinkerJobsDone, int blockedCount, int assignedCount ) { 18 this.jobCount= jobCount; 19 this.spiderJobsCount= spiderJobsCount; 20 this.thinkerJobsCount= thinkerJobsCount; 21 this.jobsDone = jobsDone; 22 this.spiderJobsDone = spiderJobsDone; 23 this.thinkerJobsDone = thinkerJobsDone; 24 this.blockedCount = blockedCount; 25 this.assignedCount = assignedCount; 26 } 27 28 public String toString ( ) { 29 int pctDone = 0; 30 if ( getJobCount() != 0 ) { 31 pctDone = ((getJobsDone()*100)/getJobCount()); 32 } 33 int spidersPctDone = 0; 34 if ( getSpiderJobsCount() != 0) { 35 spidersPctDone = ((getSpiderJobsDone()*100)/getSpiderJobsCount()); 36 } 37 int thinkersPctDone = 0; 38 if ( getThinkerJobsCount() != 0) { 39 thinkersPctDone = ((getThinkerJobsDone()*100)/getThinkerJobsCount()); 40 } 41 return "Job monitor: " + pctDone + "% (" + getJobsDone() + "/" + getJobCount() + ") [S:" + spidersPctDone + "% (" + getSpiderJobsDone() + "/" + getSpiderJobsCount() + ") | T:" + thinkersPctDone + "% (" + getThinkerJobsDone() + "/" + getThinkerJobsCount() + ")] [blocked:" + blockedCount + "] [assigned:" + assignedCount + "]"; 42 } 43 44 public String getComment() { 45 return toString ( ); 46 } 47 48 public int getJobCount() { 49 return jobCount; 50 } 51 52 public int getSpiderJobsCount() { 53 return spiderJobsCount; 54 } 55 56 public int getThinkerJobsCount() { 57 return thinkerJobsCount; 58 } 59 60 public int getJobsDone() { 61 return jobsDone; 62 } 63 64 public int getSpiderJobsDone() { 65 return spiderJobsDone; 66 } 67 68 public int getThinkerJobsDone() { 69 return thinkerJobsDone; 70 } 71 72 public int getBlockedCount ( ) { 73 return blockedCount; 74 } 75 76 public int getAssignedCount ( ){ 77 return assignedCount; 78 } 79 80 } 81 | Popular Tags |