perf: 优化启动时,数据集初始化

This commit is contained in:
taojinlong 2022-03-02 22:41:29 +08:00
parent 48897c2d1e
commit 2f0bbe7c8d

View File

@ -323,11 +323,14 @@ public class DatasourceService {
public void initAllDataSourceConnectionPool() { public void initAllDataSourceConnectionPool() {
List<Datasource> datasources = datasourceMapper.selectByExampleWithBLOBs(new DatasourceExample()); List<Datasource> datasources = datasourceMapper.selectByExampleWithBLOBs(new DatasourceExample());
datasources.forEach(datasource -> { datasources.forEach(datasource -> {
try { commonThreadPool.addTask(()->{
handleConnectionPool(datasource, "add"); System.out.println(System.currentTimeMillis());
} catch (Exception e) { try {
e.printStackTrace(); handleConnectionPool(datasource, "add");
} } catch (Exception e) {
LogUtil.error("Failed to init datasource: " + datasource.getName(), e);
}
});
}); });
} }