使用多线程

ExecutorService executor = Executors.newCachedThreadPool();
for(int i=0;i<threadNum;i++){
  String[] tempOrderIds = copyOrderIds(i, orderThresholdNum,orderNum,orderIds);
  executor.execute(()->{
     try {
        doSomething(tempOrdersIds);
      } catch (Exception ex) {
        ex.printStackTrace();
      }
   });
}

 

posted @ 2018-06-07 10:52  梦见舟  阅读(53)  评论(0编辑  收藏  举报