package com.yeshi.buwan.util; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; public class ThreadUtil { private static LinkedBlockingQueue queue = new LinkedBlockingQueue(100); private static ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(30, 3000, 20, TimeUnit.SECONDS, queue); static { threadPoolExecutor.allowCoreThreadTimeOut(true); } public static void run(Runnable runnable) { threadPoolExecutor.execute(runnable); } }