Make non-overridden methods final. Gets back to pre-refactor performance.

pull/212/head
Brett Wooldridge 10 years ago
parent a6152f58a9
commit 5a90be9199

@ -166,7 +166,7 @@ public abstract class BaseHikariPool implements HikariPoolMBean, IBagStateListen
* @return a java.sql.Connection instance * @return a java.sql.Connection instance
* @throws SQLException thrown if a timeout occurs trying to obtain a connection * @throws SQLException thrown if a timeout occurs trying to obtain a connection
*/ */
public Connection getConnection() throws SQLException public final Connection getConnection() throws SQLException
{ {
suspendResumeLock.acquire(); suspendResumeLock.acquire();
long timeout = connectionTimeout; long timeout = connectionTimeout;
@ -210,7 +210,7 @@ public abstract class BaseHikariPool implements HikariPoolMBean, IBagStateListen
* @param bagEntry the PoolBagEntry to release back to the pool * @param bagEntry the PoolBagEntry to release back to the pool
* @param isBroken true if the connection was detected as broken * @param isBroken true if the connection was detected as broken
*/ */
public void releaseConnection(final PoolBagEntry bagEntry, final boolean isBroken) public final void releaseConnection(final PoolBagEntry bagEntry, final boolean isBroken)
{ {
metricsTracker.recordConnectionUsage(bagEntry); metricsTracker.recordConnectionUsage(bagEntry);
@ -230,7 +230,7 @@ public abstract class BaseHikariPool implements HikariPoolMBean, IBagStateListen
* *
* @throws InterruptedException thrown if the thread is interrupted during shutdown * @throws InterruptedException thrown if the thread is interrupted during shutdown
*/ */
public void shutdown() throws InterruptedException public final void shutdown() throws InterruptedException
{ {
if (!isShutdown) { if (!isShutdown) {
isShutdown = true; isShutdown = true;
@ -262,7 +262,7 @@ public abstract class BaseHikariPool implements HikariPoolMBean, IBagStateListen
* *
* @param proxyConnection the connection to evict * @param proxyConnection the connection to evict
*/ */
public void evictConnection(IHikariConnectionProxy proxyConnection) public final void evictConnection(IHikariConnectionProxy proxyConnection)
{ {
closeConnection(proxyConnection.getPoolBagEntry()); closeConnection(proxyConnection.getPoolBagEntry());
} }
@ -272,7 +272,7 @@ public abstract class BaseHikariPool implements HikariPoolMBean, IBagStateListen
* *
* @return the wrapped DataSource * @return the wrapped DataSource
*/ */
public DataSource getDataSource() public final DataSource getDataSource()
{ {
return dataSource; return dataSource;
} }
@ -282,7 +282,7 @@ public abstract class BaseHikariPool implements HikariPoolMBean, IBagStateListen
* *
* @return the {@link HikariConfig} for this pool * @return the {@link HikariConfig} for this pool
*/ */
public HikariConfig getConfiguration() public final HikariConfig getConfiguration()
{ {
return configuration; return configuration;
} }
@ -299,35 +299,35 @@ public abstract class BaseHikariPool implements HikariPoolMBean, IBagStateListen
/** {@inheritDoc} */ /** {@inheritDoc} */
@Override @Override
public int getActiveConnections() public final int getActiveConnections()
{ {
return connectionBag.getCount(STATE_IN_USE); return connectionBag.getCount(STATE_IN_USE);
} }
/** {@inheritDoc} */ /** {@inheritDoc} */
@Override @Override
public int getIdleConnections() public final int getIdleConnections()
{ {
return connectionBag.getCount(STATE_NOT_IN_USE); return connectionBag.getCount(STATE_NOT_IN_USE);
} }
/** {@inheritDoc} */ /** {@inheritDoc} */
@Override @Override
public int getTotalConnections() public final int getTotalConnections()
{ {
return connectionBag.size() - connectionBag.getCount(STATE_REMOVED); return connectionBag.size() - connectionBag.getCount(STATE_REMOVED);
} }
/** {@inheritDoc} */ /** {@inheritDoc} */
@Override @Override
public int getThreadsAwaitingConnection() public final int getThreadsAwaitingConnection()
{ {
return connectionBag.getPendingQueue(); return connectionBag.getPendingQueue();
} }
/** {@inheritDoc} */ /** {@inheritDoc} */
@Override @Override
public void suspendPool() public final void suspendPool()
{ {
if (!isPoolSuspended) { if (!isPoolSuspended) {
suspendResumeLock.suspend(); suspendResumeLock.suspend();
@ -337,7 +337,7 @@ public abstract class BaseHikariPool implements HikariPoolMBean, IBagStateListen
/** {@inheritDoc} */ /** {@inheritDoc} */
@Override @Override
public void resumePool() public final void resumePool()
{ {
if (isPoolSuspended) { if (isPoolSuspended) {
isPoolSuspended = false; isPoolSuspended = false;
@ -360,7 +360,7 @@ public abstract class BaseHikariPool implements HikariPoolMBean, IBagStateListen
/** /**
* Create and add a single connection to the pool. * Create and add a single connection to the pool.
*/ */
protected boolean addConnection() protected final boolean addConnection()
{ {
// Speculative increment of totalConnections with expectation of success // Speculative increment of totalConnections with expectation of success
if (totalConnections.incrementAndGet() > configuration.getMaximumPoolSize()) { if (totalConnections.incrementAndGet() > configuration.getMaximumPoolSize()) {
@ -451,7 +451,7 @@ public abstract class BaseHikariPool implements HikariPoolMBean, IBagStateListen
return configuration.getConnectionCustomizer(); return configuration.getConnectionCustomizer();
} }
public void logPoolState(String... prefix) public final void logPoolState(String... prefix)
{ {
if (LOGGER.isDebugEnabled()) { if (LOGGER.isDebugEnabled()) {
LOGGER.debug("{}pool stats {} (total={}, inUse={}, avail={}, waiting={})", LOGGER.debug("{}pool stats {} (total={}, inUse={}, avail={}, waiting={})",

Loading…
Cancel
Save