1 17 18 package org.apache.james.util.watchdog; 19 20 import org.apache.avalon.excalibur.pool.DefaultPool; 21 import org.apache.avalon.excalibur.pool.HardResourceLimitingPool; 22 import org.apache.avalon.excalibur.pool.ObjectFactory; 23 import org.apache.avalon.excalibur.pool.Pool; 24 import org.apache.avalon.excalibur.pool.Poolable; 25 import org.apache.avalon.excalibur.thread.ThreadPool; 26 import org.apache.avalon.framework.activity.Disposable; 27 import org.apache.avalon.framework.activity.Initializable; 28 import org.apache.avalon.framework.logger.AbstractLogEnabled; 29 import org.apache.avalon.framework.logger.LogEnabled; 30 31 36 public class ThreadPerWatchdogFactory 37 extends AbstractLogEnabled 38 implements WatchdogFactory { 39 40 43 private ThreadPool myThreadPool; 44 45 48 private long timeout; 49 50 54 public ThreadPerWatchdogFactory(ThreadPool theThreadPool, long timeout) { 55 if (theThreadPool == null) { 56 throw new IllegalArgumentException ("The thread pool for the ThreadPerWatchdogFactory cannot be null."); 57 } 58 myThreadPool = theThreadPool; 59 this.timeout = timeout; 60 } 61 62 65 public Watchdog getWatchdog(WatchdogTarget theTarget) 66 throws Exception { 67 InaccurateTimeoutWatchdog watchdog = new InaccurateTimeoutWatchdog(timeout, theTarget, myThreadPool); 68 watchdog.enableLogging(getLogger()); 69 return watchdog; 70 } 71 } 72 | Popular Tags |