small refactor

This commit is contained in:
DigitalSonic
2020-02-06 15:13:47 +08:00
parent 34aa0c8cd1
commit 3ebdc2ce4c
@@ -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);
}
}