public void pushAllGoodsPrice(final int pageSize) {
// 先查出所有店铺
List storeList = storeGoodsPriceDAO.queryAllStoreCode();
List futureList = new ArrayList();
for (final String storeCode : storeList) {
Future future = executorService.submit(new Runnable() {
@Override
public void run() {
int count = 0;
int pageNumber = 1;
try {
do {
// step2.获取价格信息
List solrList = storeGoodsPriceDAO.querySolrStoreGoodsPrice(
storeCode, pageNumber, pageSize).getResult();
if (CollectionUtils.isEmpty(solrList)) {
break;
}
count += solrList.size();
pageNumber++;
Date dateStart = new Date();
// ESB推送价格信息
dispatchPushStoreGoodsPriceList(solrList);
Date dateEnd = new Date();
LOGGER.info(“推送门店现货:{}价格信息pushAll count:{}, use {} ms.”, storeCode, count,
dateEnd.getTime() - dateStart.getTime());
try {
Thread.sleep(100);
} catch (Exception e) {
LOGGER.error(“sleep.error”, e);
}
} while (count % pageSize == 0);
} catch (Exception e) {
LOGGER.error(“推送门店现货价格信息pushAll thread sleep error.”, e);
}
}
});
futureList.add(future);
}
for (Future future : futureList) {
try {
future.get();
} catch (Exception e) {
LOGGER.error("Syn pushAllGoodsPrice调用失败忽略", e);
}
}
}