Skip to content

Commit

Permalink
modified based on cr
Browse files Browse the repository at this point in the history
  • Loading branch information
loserwang1024 committed Aug 1, 2024
1 parent be3a689 commit 3b722ff
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,10 @@ public String getJdbcUrl(
}

public void clear() throws IOException {
if (instance != null) {
synchronized (instance.pools) {
instance.pools.values().stream().forEach(HikariDataSource::close);
instance.pools.clear();
POOL_FACTORY_MAP.clear();
}
synchronized (pools) {
pools.values().stream().forEach(HikariDataSource::close);
pools.clear();
POOL_FACTORY_MAP.clear();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ public HikariDataSource getOrCreateConnectionPool(
}
}

public synchronized void clear() throws IOException {
synchronized (INSTANCE.pools) {
INSTANCE.pools.values().stream().forEach(HikariDataSource::close);
INSTANCE.pools.clear();
public void clear() throws IOException {
synchronized (pools) {
pools.values().stream().forEach(HikariDataSource::close);
pools.clear();
}
}
}

0 comments on commit 3b722ff

Please sign in to comment.