NutzCN Logo
问答 hreadPoolExecutor.<init>(ThreadPoolExecutor.java:1314)创建线程池异常
发布于 1441天前 作者 Hamming 1739 次浏览 复制 上一个帖子 下一个帖子
标签:

参考如下 创建线程池 为什么就异常了呢

        //创建线程池处理
        ThreadFactory namedThreadFactory = new ThreadFactoryBuilder().setNameFormat("getData-pool-%d").build();
        ExecutorService pool = new ThreadPoolExecutor(5, 4,
                0L, TimeUnit.MILLISECONDS,
                new LinkedBlockingQueue<Runnable>(1024), namedThreadFactory, new ThreadPoolExecutor.AbortPolicy());

求大神赐教

[WARN ] 15:06:41.507 io.nutz.nutzsite.common.mvc.processor.ErrorProcessor.process(ErrorProcessor.java:43) - Error@/keywords/followSale/syncData :
java.lang.IllegalArgumentException
	at java.util.concurrent.ThreadPoolExecutor.<init>(ThreadPoolExecutor.java:1314)
	at io.nutz.nutzsite.module.keywords.services.impl.FollowSaleServiceImpl.synchronousData(FollowSaleServiceImpl.java:64)
	at io.nutz.nutzsite.module.keywords.controller.FollowSaleController.syncData(FollowSaleController.java:159)
	at io.nutz.nutzsite.module.keywords.controller.FollowSaleController$FM$syncData$be01c9b3d0518ef9d786c8a29f9ae2fd.invoke(FollowSaleController.java)
1 回复

改成酱紫 可以了

ExecutorService pool = new ThreadPoolExecutor(1, 4,
                0L, TimeUnit.MILLISECONDS,
                new LinkedBlockingQueue<Runnable>(1024), namedThreadFactory, new ThreadPoolExecutor.AbortPolicy());

添加回复
请先登陆
回到顶部