| 1 10 package org.mmbase.util; 11 import edu.emory.mathcs.backport.java.util.concurrent.*; 12 import org.mmbase.util.logging.*; 13 20 public abstract class ThreadPools { 21 private static final Logger log = Logging.getLoggerInstance(ThreadPools.class); 22 23 26 public static final Executor filterExecutor = Executors.newCachedThreadPool(); 27 28 29 32 public static final Executor jobsExecutor = new ThreadPoolExecutor(2, 10, 5, TimeUnit.MINUTES, new LinkedBlockingQueue(), new ThreadFactory() { 33 34 public Thread newThread(Runnable r) { 35 Thread t = new Thread (r, "JOBTHREAD") { 36 39 public void run() { 40 try { 41 super.run(); 42 } catch (Throwable t) { 43 log.error("Error during job: " + t.getClass().getName() + " " + t.getMessage(), t); 44 } 45 } 46 }; 47 t.setDaemon(true); 48 return t; 49 } 50 }); 51 52 53 } 54 | Popular Tags |