List<Map<String, Map<String, String>>> data = new ArrayList<>(13);
//线程池
ExecutorService threadPool = Executors.newFixedThreadPool(5);
final Connection conn = JDBCHelper.getConnection();
final Statement st = conn.createStatement();
List<Map<String, String>> mpList = threadPool.submit(new Callable<List<Map<String, String>>>() {
@Override
public List<Map<String, String>> call() throws Exception {
return BaseDao.selectAll(st,"select spcode,i17_type_8,i17_type_4,entry_year,grp_id_iy,grp_id_lc,max_prd_no,term_os_m,variable_fee,ifrs_mtd,csm_nb_idx from lifedata.mp");
}
}).get();
List<Map<String, String>> pocGroupDataList = threadPool.submit(new Callable<List<Map<String, String>>>() {
@Override
public List<Map<String, String>> call() throws Exception {
return BaseDao.selectAll(st,"select * from lifedata.poc_group_data ");
}
}).get();
List<Map<String, String>> t0CsmList = threadPool.submit(new Callable<List<Map<String, String>>>() {
@Override
public List<Map<String, String>> call() throws Exception {
return BaseDao.selectAll(st,"select * from lifedata.t0_csm");
}
}).get();
List<Map<String, String>> t0IacfList =threadPool.submit(new Callable<List<Map<String, String>>>() {
@Override
public List<Map<String, String>> call() throws Exception {
return BaseDao.selectAll(st,"select * from lifedata.t0_iacf");
}
}).get();
List<Map<String, String>> disRateList0 =threadPool.submit(new Callable<List<Map<String, String>>>() {
@Override
public List<Map<String, String>> call() throws Exception {
return BaseDao.selectAll(st,"select * from lifedata.discount_rate");
}
}).get();
threadPool.shutdown();
threadPool.awaitTermination(Long.MAX_VALUE, TimeUnit.NANOSECONDS);
st.close();
conn.close();
java-并发读取数据库
最新推荐文章于 2024-03-29 09:33:01 发布