1 18 23 24 package org.apache.roller.business.runnable; 25 26 import org.apache.commons.logging.Log; 27 import org.apache.commons.logging.LogFactory; 28 29 30 35 public class ContinuousWorkerThread extends WorkerThread { 36 37 private static Log mLogger = LogFactory.getLog(ContinuousWorkerThread.class); 38 39 long sleepTime = 10000; 41 42 43 public ContinuousWorkerThread(String id) { 44 super(id); 45 } 46 47 48 public ContinuousWorkerThread(String id, long sleep) { 49 super(id); 50 51 this.sleepTime = sleep; 52 } 53 54 55 public ContinuousWorkerThread(String id, Job job) { 56 super(id, job); 57 } 58 59 60 public ContinuousWorkerThread(String id, Job job, long sleep) { 61 super(id, job); 62 63 this.sleepTime = sleep; 64 } 65 66 67 75 public void run() { 76 77 mLogger.info(this.id+" Started."); 78 79 while(true) { 81 82 super.run(); 84 85 try { 87 mLogger.debug(this.id+" SLEEPING for "+this.sleepTime+" milliseconds ..."); 88 this.sleep(this.sleepTime); 89 } catch (InterruptedException e) { 90 mLogger.info(this.id+" INTERRUPT: "+e.getMessage()); 91 break; 92 } 93 } 94 } 95 96 } 97 | Popular Tags |