mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
small refactor
This commit is contained in:
@@ -20,6 +20,7 @@ import com.alibaba.druid.pool.ha.DataSourceCreator;
|
||||
import com.alibaba.druid.pool.ha.HighAvailableDataSource;
|
||||
import com.alibaba.druid.support.logging.Log;
|
||||
import com.alibaba.druid.support.logging.LogFactory;
|
||||
import com.alibaba.druid.util.JdbcUtils;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
import java.util.HashSet;
|
||||
@@ -205,13 +206,7 @@ public class PoolUpdater implements Observer {
|
||||
LOG.info("Creating Node " + nodeName + "[url: " + url + ", username: " + username + "].");
|
||||
} catch (Exception e) {
|
||||
LOG.error("Can NOT create DataSource " + nodeName + ". IGNORE IT.", e);
|
||||
if (dataSource != null) {
|
||||
try {
|
||||
dataSource.close();
|
||||
} catch (Exception ex) {
|
||||
LOG.error("Exception occurred while closing the FAILURE DataSource.", ex);
|
||||
}
|
||||
}
|
||||
JdbcUtils.close(dataSource);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user