@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; } }
|