标签:OLE dfa adp set read ice == zed linked
public class ThreadPoolExecutorUtils { private static final int CORE_POOL_SIZE = 10; private static final int MAX_POOL_SIZE = 20; private static final long KEEP_ALIVE_TIME = 30; private static final int QUEUE_SIZE = 20; private static final String THREAD_POOL_NAME = "thread-pool"; private static volatile ExecutorService pool = null; private ThreadPoolExecutorUtils(){ } public static ExecutorService getPool() { // 使用双重校验锁保证只有一个pool实例 if (pool == null) { synchronized (ThreadPoolExecutorUtils.class) { if (pool == null) { ThreadFactory namedThreadFactory = new ThreadFactoryBuilder().setNameFormat(THREAD_POOL_NAME + "-%d").build(); pool = new ThreadPoolExecutor(CORE_POOL_SIZE, MAX_POOL_SIZE, KEEP_ALIVE_TIME, TimeUnit.SECONDS, new LinkedBlockingQueue<>(QUEUE_SIZE), namedThreadFactory, new ThreadPoolExecutor.AbortPolicy()); } } } return pool; } }
标签:OLE dfa adp set read ice == zed linked
原文地址:https://www.cnblogs.com/tilamisu007/p/12056294.html