Minor cleanup.

pull/41/head
Brett Wooldridge 11 years ago
parent 633eafbed4
commit 62c7bd2a93

@ -69,6 +69,7 @@ public class HikariConfig implements HikariConfigMBean
private boolean isRegisterMbeans;
private DataSource dataSource;
private Properties dataSourceProperties;
private IConnectionCustomizer connectionCustomizer;
static
{
@ -454,13 +455,14 @@ public class HikariConfig implements HikariConfigMBean
acquireRetryDelay = ACQUIRE_RETRY_DELAY;
}
if (connectionCustomizerClassName != null)
if (connectionCustomizerClassName != null && connectionCustomizer == null)
{
try
{
getClass().getClassLoader().loadClass(connectionCustomizerClassName);
Class<?> customizerClass = getClass().getClassLoader().loadClass(connectionCustomizerClassName);
connectionCustomizer = (IConnectionCustomizer) customizerClass.newInstance();
}
catch (ClassNotFoundException e)
catch (Exception e)
{
logger.warn("connectionCustomizationClass specified class '" + connectionCustomizerClassName + "' could not be loaded", e);
connectionCustomizerClassName = null;
@ -528,6 +530,11 @@ public class HikariConfig implements HikariConfigMBean
}
}
IConnectionCustomizer getConnectionCustomizer()
{
return connectionCustomizer;
}
void copyState(HikariConfig other)
{
for (Field field : HikariConfig.class.getDeclaredFields())

@ -77,14 +77,15 @@ public final class HikariPool implements HikariPoolMBean, IBagStateListener
this.totalConnections = new AtomicInteger();
this.idleConnectionBag = new ConcurrentBag<IHikariConnectionProxy>();
this.idleConnectionBag.addBagStateListener(this);
this.debug = LOGGER.isDebugEnabled();
this.jdbc4ConnectionTest = configuration.isJdbc4ConnectionTest();
this.leakDetectionThreshold = configuration.getLeakDetectionThreshold();
this.catalog = configuration.getCatalog();
this.connectionCustomizer = configuration.getConnectionCustomizer();
this.isAutoCommit = configuration.isAutoCommit();
this.isRegisteredMbeans = configuration.isRegisterMbeans();
this.jdbc4ConnectionTest = configuration.isJdbc4ConnectionTest();
this.leakDetectionThreshold = configuration.getLeakDetectionThreshold();
this.transactionIsolation = configuration.getTransactionIsolation();
this.catalog = configuration.getCatalog();
this.debug = LOGGER.isDebugEnabled();
if (configuration.getDataSource() == null)
{
@ -105,23 +106,6 @@ public final class HikariPool implements HikariPoolMBean, IBagStateListener
this.dataSource = configuration.getDataSource();
}
if (configuration.getConnectionCustomizerClassName() != null)
{
try
{
Class<?> clazz = this.getClass().getClassLoader().loadClass(configuration.getConnectionCustomizerClassName());
this.connectionCustomizer = (IConnectionCustomizer) clazz.newInstance();
}
catch (Exception e)
{
throw new RuntimeException("Could not load connection customization class", e);
}
}
else
{
this.connectionCustomizer = null;
}
if (isRegisteredMbeans)
{
HikariMBeanElf.registerMBeans(configuration, this);

@ -163,20 +163,22 @@ public final class JavassistProxyFactory
targetCt.addInterface(intfCt);
for (CtMethod intfMethod : intfCt.getDeclaredMethods())
{
if (superSigs.contains(intfMethod.getName() + intfMethod.getSignature()))
final String signature = intfMethod.getName() + intfMethod.getSignature();
// don't generate delegates for methods we override
if (superSigs.contains(signature))
{
// don't generate delegates for methods we override
continue;
}
// Ignore already added methods that come from other interfaces
if (methods.contains(intfMethod.getName() + intfMethod.getSignature()))
if (methods.contains(signature))
{
continue;
}
// Track what methods we've added
methods.add(intfMethod.getName() + intfMethod.getSignature());
methods.add(signature);
// Clone the method we want to inject into
CtMethod method = CtNewMethod.copy(intfMethod, targetCt, null);

Loading…
Cancel
Save