1 List<List<String>> subList = CommonUtils.splitList(pendingIds, 500);

private static final ThreadFactory NAMED_THREAD_FACTORY =
 2                 new ThreadFactoryBuilder().setNameFormat("syncContractLine-pool-%d").build();
3 ThreadPoolExecutor threadPool = new ThreadPoolExecutor(10, 20, 500, TimeUnit.MILLISECONDS,
4 new LinkedBlockingQueue<>(500), NAMED_THREAD_FACTORY, new ThreadPoolExecutor.AbortPolicy());
5 IRequestContext current = RequestContextManager.getCurrent();
6 List<CompletableFuture<Void>> futureList = new ArrayList<>();
7 for (List<String> subPendingIds : subList) {
8 CompletableFuture<Void> future = CompletableFuture.runAsync(() -> {
9 RequestContextManager.setCurrent(current);
10 LOGGER.info("handle contractLines start");
11 if (CommonUtils.isNotEmpty(subPendingIds)) {
12 for (String id : subPendingIds) {
13 map.put("contract", id);
14 iContractHeaderInfoService.syncContractLineInfo(map);
15 }
16 }
17 LOGGER.info("handle contractLines end");
18 }, threadPool);
19 futureList.add(future);
20 }
21 CompletableFuture.allOf(futureList.toArray(new CompletableFuture[futureList.size()])).join();
22 threadPool.shutdown();

最新文章

  1. 1.3 jQuery基础
  2. putty如何使用
  3. Eclipse导出可执行Java工程/可执行Jar文件(包含第三方Jar包)
  4. BZOJ1565: [NOI2009]植物大战僵尸
  5. 虚析构函数(√)、纯虚析构函数(√)、虚构造函数(X)
  6. 10个你能参与并学习的Java开源项目
  7. phpMyAdmin import.php 跨站脚本漏洞
  8. SPOJ 1043 1043. Can you answer these queries I
  9. XmlDocument加载有Xmlns的xml文档,使用Xpath
  10. BZOJ 1708: [Usaco2007 Oct]Money奶牛的硬币
  11. There was a problem parsing the package(android)
  12. appium python ios 自动化
  13. ngRx 官方示例分析 - 3. reducers
  14. C# 值类型与引用类型的异同
  15. 数据合并处理concat
  16. python头部 #!/usr/bin/env python
  17. Ruby 集合数组常用遍历方法
  18. maven plugins
  19. php and mysql 常用api函数
  20. Nginx的几个常用配置和技巧

热门文章

  1. 用例需注意的点-UI自动化
  2. [学习计划]mysql常用语句-随学随整理
  3. SAP BW/4HANA学习笔记2
  4. 072_关于Dataloader导入Record的创建时间及修改时间并允许owner是Inactive
  5. 【Java】自定义mybatis
  6. Tooltip 文字提示,居中显示
  7. float高度塌陷和BFC
  8. hexo博客重新部署
  9. VMware Workstation Ubuntu 20.04 LTS无法连接网络问题
  10. 多线程问题sleep与wait