Code example for DataSource

Methods: getConnection, sleep

0
        for (int i = 0; i < 30; i++) {
            executorService.submit(new Runnable() {
                public void run() { 
                    try { 
                        Thread.sleep(1000);
                        Connection connection = dataSource.getConnection();
                        Thread.sleep(1000);
                        connection.close();
                    } catch (Exception e) {
                        e.printStackTrace();
                    } 
                } 
            }); 
        } 
        System.err.println("添加任务完成");
    } 
}