多线程分模块执行任务

Callable<List> newGoodsListCallable = null;

Callable<List> hotGoodsListCallable = null;

newGoodsListCallable = () -> goodsService.queryByNew(0, SystemConfig.getNewLimit(),bindingGoodsList,goodsList,true);

hotGoodsListCallable = () -> goodsService.queryByHot(0, SystemConfig.getHotLimit(),bindingGoodsList,goodsList,true);

FutureTask<List> newGoodsListTask = new FutureTask<>(newGoodsListCallable);

FutureTask<List> hotGoodsListTask = new FutureTask<>(hotGoodsListCallable);

executorService.submit(newGoodsListTask);

executorService.submit(hotGoodsListTask);


data.put("newGoodsList", newGoodsListTask.get());

data.put("hotGoodsList", hotGoodsListTask.get());
posted @ 2022-04-02 15:46  雨后丶云初霁  阅读(39)  评论(0编辑  收藏  举报