Skip to content

Commit

Permalink
fix seata-samples-api dataSource repeat (#578)
Browse files Browse the repository at this point in the history
  • Loading branch information
PeppaO committed Oct 28, 2022
1 parent bd480f1 commit 4e4a579
Showing 1 changed file with 1 addition and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,7 @@ public static DataSource getDataSource(String name) {
* @throws SQLException the sql exception
*/
public static Connection getConnection(String name) throws SQLException {
DATA_SOURCE_MAP.putIfAbsent(name, getDataSource(name));
return DATA_SOURCE_MAP.get(name).getConnection();
return DATA_SOURCE_MAP.computeIfAbsent(name, s -> getDataSource(name)).getConnection();
}

/**
Expand Down

0 comments on commit 4e4a579

Please sign in to comment.