1 6 package org.logicalcobwebs.proxool.admin; 7 8 import org.apache.commons.logging.Log; 9 import org.apache.commons.logging.LogFactory; 10 import org.logicalcobwebs.proxool.ProxoolException; 11 import org.logicalcobwebs.proxool.ProxoolFacade; 12 import org.logicalcobwebs.proxool.ResultMonitor; 13 14 22 public class StatisticsResultMonitor extends ResultMonitor { 23 24 private static final Log LOG = LogFactory.getLog(StatisticsResultMonitor.class); 25 26 private StatisticsIF statistics; 27 28 private StatisticsIF oldStatistics; 29 30 private String alias; 31 32 private String token; 33 34 38 public StatisticsResultMonitor(String alias, String token) { 39 this.alias = alias; 40 this.token = token; 41 setDelay(2000); 42 } 43 44 49 public boolean check() throws Exception { 50 statistics = ProxoolFacade.getStatistics(alias, token); 51 if (statistics == null) { 52 return false; 53 } else if (oldStatistics == null) { 54 return check(statistics); 55 } else { 56 if (!statistics.getStartDate().equals(oldStatistics.getStartDate())) { 57 return check(statistics); 58 } else { 59 return false; 60 } 61 } 62 } 63 64 72 protected boolean check(StatisticsIF statistics) { 73 return true; 74 } 75 76 public int getResult() throws ProxoolException { 77 oldStatistics = statistics; 78 return super.getResult(); 79 } 80 81 85 public StatisticsIF getStatistics() { 86 return statistics; 87 } 88 } 89 90 91 | Popular Tags |