1 29 30 package com.caucho.server.thread; 31 32 import com.caucho.util.L10N; 33 import com.caucho.util.ThreadPool; 34 35 import java.util.concurrent.Executor ; 36 import java.util.logging.Logger ; 37 38 41 public class ResinThreadPoolExecutor implements Executor { 42 private static final L10N L = new L10N(ResinThreadPoolExecutor.class); 43 private static final Logger log 44 = Logger.getLogger(ResinThreadPoolExecutor.class.getName()); 45 46 private static ResinThreadPoolExecutor _service 47 = new ResinThreadPoolExecutor(); 48 49 private ThreadPool _threadPool = ThreadPool.getThreadPool(); 50 51 private ResinThreadPoolExecutor() 52 { 53 } 54 55 public static ResinThreadPoolExecutor getThreadPool() 56 { 57 return _service; 58 } 59 60 64 public void execute(Runnable task) 65 { 66 if (task == null) 67 throw new NullPointerException (); 68 69 _threadPool.schedule(task); 70 } 71 72 75 public void stopEnvironment(ClassLoader env) 76 { 77 _threadPool.closeEnvironment(env); 78 } 79 80 public String toString() 81 { 82 return "ResinThreadPoolExecutor[]"; 83 } 84 } 85 | Popular Tags |