线程池创建
Posted wanhua-wu
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了线程池创建相关的知识,希望对你有一定的参考价值。
static final int poolSize = 50; static final long keepAliveTime = 0L; static final ThreadFactory threadFactory = new ThreadFactoryBuilder().setNameFormat("Thread-pool-MlanguageNavigationAspect-%d").setDaemon(true).build(); static final ExecutorService executorService = new ThreadPoolExecutor( poolSize, poolSize, keepAliveTime, TimeUnit.MILLISECONDS, //无界队列 LinkedBlockingQueue //有界队列 ArrayBlockingQueue PriorityBlockingQueue //同步移交 SynchronousQueue new LinkedBlockingQueue<Runnable>(), threadFactory, //AbortPolicy中止策略 //DiscardPolicy抛弃策略 //DiscardOldestPolicy抛弃旧任务策略 //CallerRunsPolicy调用者运行 new ThreadPoolExecutor.AbortPolicy());
以上是关于线程池创建的主要内容,如果未能解决你的问题,请参考以下文章