java-并发读取数据库

 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();
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

猿与禅

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值