diff --git a/src/main/java/com/zaxxer/hikari/HikariConfig.java b/src/main/java/com/zaxxer/hikari/HikariConfig.java index c95ae376..e5936843 100644 --- a/src/main/java/com/zaxxer/hikari/HikariConfig.java +++ b/src/main/java/com/zaxxer/hikari/HikariConfig.java @@ -23,6 +23,8 @@ import java.lang.reflect.Field; import java.lang.reflect.Modifier; import java.sql.Connection; import java.util.Properties; +import java.util.Set; +import java.util.TreeSet; import java.util.concurrent.TimeUnit; import javax.sql.DataSource; @@ -140,24 +142,6 @@ public class HikariConfig implements HikariConfigMBean } } - @Deprecated - public void setAcquireIncrement(int acquireIncrement) - { - LOGGER.warn("The acquireIncrement property has been retired, remove it from your pool configuration to avoid this warning."); - } - - @Deprecated - public void setAcquireRetries(int acquireRetries) - { - LOGGER.warn("The acquireRetries property has been retired, remove it from your pool configuration to avoid this warning."); - } - - @Deprecated - public void setAcquireRetryDelay(long acquireRetryDelayMs) - { - LOGGER.warn("The acquireRetryDelay property has been retired, remove it from your pool configuration to avoid this warning."); - } - /** * Get the default catalog name to be set on connections. * @@ -477,12 +461,6 @@ public class HikariConfig implements HikariConfigMBean this.leakDetectionThreshold = leakDetectionThresholdMs; } - @Deprecated - public void setUseInstrumentation(boolean useInstrumentation) - { - LOGGER.warn("The useInstrumentation property has been retired, remove it from your pool configuration to avoid this warning."); - } - /** {@inheritDoc} */ @Override public long getMaxLifetime() @@ -497,12 +475,6 @@ public class HikariConfig implements HikariConfigMBean this.maxLifetime = maxLifetimeMs; } - @Deprecated - public void setMinimumPoolSize(int minPoolSize) - { - LOGGER.warn("The minimumPoolSize property has been retired, remove it from your pool configuration to avoid this warning."); - } - /** {@inheritDoc} */ @Override public int getMaximumPoolSize() @@ -680,6 +652,8 @@ public class HikariConfig implements HikariConfigMBean } poolName = "HikariPool-" + poolNumber++; + + logConfiguration(); } private void validateNumerics() @@ -730,6 +704,29 @@ public class HikariConfig implements HikariConfigMBean } } + private void logConfiguration() + { + LOGGER.debug("HikariCP pool {} configuration:", poolName); + Set propertyNames = new TreeSet(PropertyBeanSetter.getPropertyNames(HikariConfig.class)); + StringBuilder sb = new StringBuilder(); + for (String prop : propertyNames) + { + try + { + sb.append(prop).append("................................................"); + sb.setLength(32); + Object value = PropertyBeanSetter.getProperty(prop, this); + sb.append((value != null ? value : "")); + LOGGER.debug(sb.toString()); + sb.setLength(0); + } + catch (Exception e) + { + continue; + } + } + } + void copyState(HikariConfig other) { for (Field field : HikariConfig.class.getDeclaredFields()) diff --git a/src/main/java/com/zaxxer/hikari/util/PropertyBeanSetter.java b/src/main/java/com/zaxxer/hikari/util/PropertyBeanSetter.java index 03f2598b..845f6bf9 100644 --- a/src/main/java/com/zaxxer/hikari/util/PropertyBeanSetter.java +++ b/src/main/java/com/zaxxer/hikari/util/PropertyBeanSetter.java @@ -77,7 +77,10 @@ public final class PropertyBeanSetter BeanInfo info = Introspector.getBeanInfo(targetClass); for (PropertyDescriptor descr : info.getPropertyDescriptors()) { - set.add(descr.getName()); + if (!"class".equals(descr.getName())) + { + set.add(descr.getName()); + } } return set; @@ -88,6 +91,29 @@ public final class PropertyBeanSetter } } + public static Object getProperty(String propName, Object target) + { + try + { + String capitalized = "get" + propName.substring(0, 1).toUpperCase() + propName.substring(1); + Method method = target.getClass().getMethod(capitalized); + return method.invoke(target); + } + catch (Exception e) + { + try + { + String capitalized = "is" + propName.substring(0, 1).toUpperCase() + propName.substring(1); + Method method = target.getClass().getMethod(capitalized); + return method.invoke(target); + } + catch (Exception e2) + { + return null; + } + } + } + private static void setProperty(Object target, String propName, Object propValue) { String capitalized = "set" + propName.substring(0, 1).toUpperCase() + propName.substring(1);