Fix potential connection leak bug when closing NacosDataSource (#2962)

This commit is contained in:
pandaapo 2023-01-05 20:30:21 +08:00 committed by LearningGp
parent e2580a0585
commit 44080bc886
1 changed files with 6 additions and 0 deletions

View File

@ -145,6 +145,12 @@ public class NacosDataSource<T> extends AbstractDataSource<String, T> {
public void close() { public void close() {
if (configService != null) { if (configService != null) {
configService.removeListener(dataId, groupId, configListener); configService.removeListener(dataId, groupId, configListener);
try {
configService.shutDown();
} catch (Exception e) {
RecordLog.warn("[NacosDataSource] Error occurred when closing Nacos data source", e);
e.printStackTrace();
}
} }
pool.shutdownNow(); pool.shutdownNow();
} }