Callable多线程问题,求高手解答!谢谢。
创建了5个线程处理4.5W条数据入库操作, 给这每个线程处理1W条,当5个线程中的一个线程运行结束时候,其他线程也不执行了。TOMCAT没死,程序其他操作还在执行,就是线程池中的其他4个线程不继续执行下去了。。。
线程操作类
public class HotelDetailThread implements Callable { private static final Logger log = Logger.getLogger(HotelDetailThread.class); private HotelDao hotelDao; private List listHotelId; private String index; public HotelDetailThread(List listHotelId, String index,HotelDao hotelDao) { this.listHotelId = listHotelId; this.index = index; this.hotelDao = hotelDao; } public Object call() throws Exception { for (int i = 0; i < listHotelId.size(); i++) { HotelEntity hotelId = (HotelEntity) listHotelId.get(i); hotelDao.modifyHotelEntity(hotelId); // 执行更新操作 } return ""; }}ExecutorService pool = Executors.newCachedThreadPool(); for (int i = 1; i <= maxPage; i++) { PageListBean bean = new PageListBean(); bean.setCurrentPage(i); List pagerList = bean.getPaper(listStr, pageSize); Callable c = new HotelDetailThread(pagerList, i+"",hotelDao); pool.submit(c); } pool.shutdown();