1 package org.apache.axis2.util.threadpool; 2 3 import org.apache.commons.logging.Log; 4 import org.apache.commons.logging.LogFactory; 5 6 11 public class ThreadWorker extends Thread { 12 protected static Log log = LogFactory.getLog(ThreadWorker.class.getName()); 13 private boolean stop; 14 private ThreadPool pool; 15 16 public void setPool(ThreadPool pool) { 17 this.pool = pool; 18 } 19 20 public boolean isStop() { 21 return stop; 22 } 23 24 public void setStop(boolean stop) { 25 this.stop = stop; 26 } 27 28 public void run() { 29 while (!stop) { 30 AxisWorker axisWorker = null; 31 try { 32 axisWorker = pool.getWorker(); 33 if (axisWorker != null) 34 axisWorker.doWork(); 35 sleep(ThreadPool.SLEEP_INTERVAL); 36 } catch (InterruptedException e) { 37 log.error(e); 38 } 39 } 40 } 41 } 42 | Popular Tags |