/** A generic pool of threads available for Alarms and Work tasks. */
public class ResinThreadPoolExecutor implements Executor {
  private static final L10N L = new L10N(ResinThreadPoolExecutor.class);
  private static final Logger log = Logger.getLogger(ResinThreadPoolExecutor.class.getName());

  private static ResinThreadPoolExecutor _service = new ResinThreadPoolExecutor();

  private ThreadPool _threadPool = ThreadPool.getThreadPool();

  private ResinThreadPoolExecutor() {}

  public static ResinThreadPoolExecutor getThreadPool() {
    return _service;
  }

  //
  // java.util.concurrent
  //

  public void execute(Runnable task) {
    if (task == null) throw new NullPointerException();

    _threadPool.schedule(task);
  }

  /** Resets the thread pool, letting old threads drain. */
  public void stopEnvironment(ClassLoader env) {
    _threadPool.closeEnvironment(env);
  }

  public String toString() {
    return "ResinThreadPoolExecutor[]";
  }
}
 /** Resets the thread pool, letting old threads drain. */
 public void stopEnvironment(ClassLoader env) {
   _threadPool.closeEnvironment(env);
 }
  public void execute(Runnable task) {
    if (task == null) throw new NullPointerException();

    _threadPool.schedule(task);
  }