Add close() method that is synonymous with shutdown(), add toString() that prints the datasource including the pool name.

pull/41/head
Brett Wooldridge 11 years ago
parent 5fc58a2306
commit de4059c0cb

@ -116,6 +116,17 @@ public class HikariDataSource implements DataSource
return (this.getClass().isAssignableFrom(iface)); return (this.getClass().isAssignableFrom(iface));
} }
/**
* <code>close()</code> and <code>shutdown()</code> are synonymous.
*/
public void close()
{
shutdown();
}
/**
* Shutdown the DataSource and its associated pool.
*/
public void shutdown() public void shutdown()
{ {
boolean shutdown = isShutdown; boolean shutdown = isShutdown;
@ -126,4 +137,11 @@ public class HikariDataSource implements DataSource
pool = null; pool = null;
} }
} }
/** {@inheritDoc} */
@Override
public String toString()
{
return String.format("HikariDataSource (%s)", pool);
}
} }

@ -241,6 +241,12 @@ public final class HikariPool implements HikariPoolMBean
} }
} }
@Override
public String toString()
{
return configuration.getPoolName();
}
void shutdown() void shutdown()
{ {
LOGGER.info("HikariCP pool " + configuration.getPoolName() + " is being shutdown."); LOGGER.info("HikariCP pool " + configuration.getPoolName() + " is being shutdown.");

Loading…
Cancel
Save