removed static log, like parent PoolBase. checking instanceof out of

loop
pull/567/head
Nitin 9 years ago
parent a007e730be
commit 4c2486e4a0

@ -63,7 +63,7 @@ import static com.zaxxer.hikari.util.UtilityElf.quietlySleep;
*/ */
public class HikariPool extends PoolBase implements HikariPoolMXBean, IBagStateListener public class HikariPool extends PoolBase implements HikariPoolMXBean, IBagStateListener
{ {
private static final Logger LOGGER = LoggerFactory.getLogger(HikariPool.class); private final Logger LOGGER = LoggerFactory.getLogger(HikariPool.class);
private static final ClockSource clockSource = ClockSource.INSTANCE; private static final ClockSource clockSource = ClockSource.INSTANCE;

@ -49,6 +49,11 @@ public final class PropertyElf
return; return;
} }
HikariConfig config = null;
if (target instanceof HikariConfig) {
config = (HikariConfig) target;
}
List<Method> methods = Arrays.asList(target.getClass().getMethods()); List<Method> methods = Arrays.asList(target.getClass().getMethods());
Enumeration<?> propertyNames = properties.propertyNames(); Enumeration<?> propertyNames = properties.propertyNames();
while (propertyNames.hasMoreElements()) { while (propertyNames.hasMoreElements()) {
@ -59,8 +64,7 @@ public final class PropertyElf
propValue = properties.get(key); propValue = properties.get(key);
} }
if (target instanceof HikariConfig && propName.startsWith("dataSource.")) { if (config != null && propName.startsWith("dataSource.")) {
HikariConfig config = (HikariConfig) target;
config.addDataSourceProperty(propName.substring("dataSource.".length()), propValue); config.addDataSourceProperty(propName.substring("dataSource.".length()), propValue);
} }
else { else {

Loading…
Cancel
Save