/***
* 多线程处理业务
* @param uids
* @return
* @throws Exception
*/
public List<OaLeaderInfoInTeamVO> dealLeaderListPensionByMutiThread(List<Long> uids, SearchUserListDTO searchUserListDTO) throws Exception{
int nums = 50;
int count=uids.size();
int thrednum = (count % nums == 0) ? (count / nums) : (count / nums + 1);
List<OaLeaderInfoInTeamVO> data = new ArrayList<>();
ExecutorService service = Executors.newFixedThreadPool(thrednum);
BlockingQueue<Future<List<OaLeaderInfoInTeamVO>>> queue = new LinkedBlockingQueue<Future<List<OaLeaderInfoInTeamVO>>>();
for (int i = 0; i < thrednum; i++) {
Future<List<OaLeaderInfoInTeamVO>> future = service.submit(read2List(i, nums,uids,searchUserListDTO));
queue.add(f
java多线程并行查询记录
最新推荐文章于 2024-08-16 10:28:17 发布