int size = list.size();
int count = 0 ;
if(size%pageSize == 0){
count = size/pageSize ;
}else{
count = size/pageSize + 1 ;
}
countDownLatch = new CountDownLatch(count);
for (int i = 0; i < count; i++) {
int start = 0 ;
int end = 0 ;
if(i == count-1){
start = i*pageSize ;
end = size ;
}else{
start = i*pageSize ;
end = (i+1)*pageSize ;
}
List segmentList = list.subList(start,end);
// service.execute(new SaveDataThread(countDownLatch,aCountryMapper,segmentList));
service.execute(new SaveDataThread(segmentList));
}
分页计算逻辑
最新推荐文章于 2023-08-16 10:31:15 发布