java创建线程池

 

Queue workQueue = corePoolSize <= 0 ? new SynchronousQueue() : new LinkedBlockingQueue(1024);
ThreadFactory threadFactory = Executors.defaultThreadFactory();
RejectedExecutionHandler handler = (RejectedExecutionHandler)ObjectUtil.defaultIfNull(builder.handler, new AbortPolicy());
ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(corePoolSize, maxPoolSize, keepAliveTime, TimeUnit.NANOSECONDS, (BlockingQueue)workQueue, threadFactory, handler);
posted @ 2022-03-18 15:39  甜菜波波  阅读(22)  评论(0编辑  收藏  举报