1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| @Slf4j public class ThreadPool { private static ThreadPoolExecutor instance; private ThreadPool() { } public static ThreadPoolExecutor getInstance(){ if (instance != null) return instance; synchronized(ThreadPool.class){ if (instance != null) return instance; instance = new ThreadPoolExecutor( coresize, maxPoolSize, keepAlive, timeUnit, workQueue, handler ); } return instance; } }
|