Browse Source

Fix:checkConnection should close connection to avoid connection leak

pull/1/MERGE
Baoqi 6 years ago
parent
commit
6a233d670d
  1. 6
      escheduler-api/src/main/java/cn/escheduler/api/service/DataSourceService.java

6
escheduler-api/src/main/java/cn/escheduler/api/service/DataSourceService.java

@ -38,6 +38,7 @@ import org.springframework.transaction.annotation.Transactional;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.*;
/**
@ -399,6 +400,11 @@ public class DataSourceService extends BaseService{
Connection con = getConnection(type, parameter);
if (con != null) {
isConnection = true;
try {
con.close();
} catch (SQLException e) {
logger.error("close connection fail at DataSourceService::checkConnection()", e);
}
}
return isConnection;
}

Loading…
Cancel
Save