使用多线程

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();
      }
   });
}

猜你喜欢

转载自www.cnblogs.com/mengjianzhou/p/9149492.html