Minor cleanup.

pull/307/head
Brett Wooldridge 10 years ago
parent 05e69c3852
commit 0b7fa4382f

@ -78,15 +78,12 @@ public class HikariJNDIFactory implements ObjectFactory
private DataSource lookupJndiDataSource(Properties properties, Context context) throws NamingException
{
DataSource jndiDS = null;
String jndiName = properties.getProperty("dataSourceJNDI");
if (context != null) {
jndiDS = (DataSource) context.lookup(jndiName);
}
else {
throw new RuntimeException("dataSourceJNDI property is configued, but local JNDI context is null.");
if (context == null) {
throw new RuntimeException("dataSourceJNDI property is configured, but local JNDI context is null.");
}
String jndiName = properties.getProperty("dataSourceJNDI");
DataSource jndiDS = (DataSource) context.lookup(jndiName);
if (jndiDS == null) {
context = (Context) (new InitialContext());
jndiDS = (DataSource) context.lookup(jndiName);

@ -231,10 +231,13 @@ public class HikariPool implements HikariPoolMBean, IBagStateListener
*
* @throws InterruptedException thrown if the thread is interrupted during shutdown
*/
public final void shutdown() throws InterruptedException
public final synchronized void shutdown() throws InterruptedException
{
if (poolState != POOL_SHUTDOWN) {
poolState = POOL_SHUTDOWN;
if (poolState == POOL_SHUTDOWN) {
return;
}
try {
LOGGER.info("HikariCP pool {} is shutting down.", configuration.getPoolName());
logPoolState("Before shutdown ");
@ -258,10 +261,14 @@ public class HikariPool implements HikariPoolMBean, IBagStateListener
assassinExecutor.awaitTermination(5L, TimeUnit.SECONDS);
closeConnectionExecutor.shutdown();
closeConnectionExecutor.awaitTermination(5L, TimeUnit.SECONDS);
}
finally {
logPoolState("After shutdown ");
unregisterMBeans(configuration, this);
metricsTracker.close();
poolState = POOL_SHUTDOWN;
}
}

@ -155,7 +155,7 @@ public final class PoolUtilities
}
catch (Throwable e) {
isValidSupported = false;
LOGGER.debug("{} - JDBC4 Connection.isValid() not supported", poolName);
LOGGER.debug("{} - JDBC4 Connection.isValid() not supported ({})", poolName, e.getMessage());
}
isValidChecked = true;

Loading…
Cancel
Save