1 package org.enhydra.shark.corbaclient.workflowadmin; 2 3 import org.enhydra.shark.corba.WorkflowService.LimitAdministration; 4 5 10 public class LimitChecker extends Thread { 11 12 private LimitAdministration limitAdmin; 13 private org.enhydra.shark.corba.WorkflowService.LimitAdministration limitAdminCORBA; 14 15 private long delay; 16 17 boolean stopped=false; 18 19 public LimitChecker(LimitAdministration la,long delay) { 20 this.limitAdmin=la; 21 this.delay=delay; 22 System.out.println("Limit checking time initialized to "+delay+" ms"); 23 start(); 24 } 25 26 public void setDelay (long delay) { 27 this.delay=delay; 28 } 29 30 public void stopChecker () { 31 stopped=true; 32 } 33 34 public void startChecker () { 35 stopped=false; 36 } 37 38 public void run() { 39 while (true) { 40 try { 41 sleep(delay); 42 if (!stopped) { 43 System.out.println("Checking limits ..."); 44 long start=System.currentTimeMillis(); 45 limitAdmin.checkLimits(); 46 long end=System.currentTimeMillis(); 47 System.out.println("Limit check finished - it lasted "+(end-start)+" ms"); 48 } 49 } catch (Exception e) { 50 e.printStackTrace(); 51 } 52 } 53 } 54 55 } 56 57 | Popular Tags |