From a11d6a6b399b330218a0c3c9be586b28c4af23dc Mon Sep 17 00:00:00 2001 From: Brett Wooldridge Date: Tue, 3 Apr 2018 03:46:03 +0900 Subject: [PATCH] Prepare for release. --- CHANGES | 33 +++++++- pom.xml | 2 +- .../java/com/zaxxer/hikari/HikariConfig.java | 83 ------------------- .../com/zaxxer/hikari/HikariDataSource.java | 43 ---------- .../com/zaxxer/hikari/HikariPoolMXBean.java | 46 +++++++++- 5 files changed, 78 insertions(+), 129 deletions(-) diff --git a/CHANGES b/CHANGES index c50bd2b0..69be0500 100644 --- a/CHANGES +++ b/CHANGES @@ -1,5 +1,36 @@ HikariCP Changes +Changes in 3.0.0 + + * Removed previously deprecated methods; + HikariConfig.copyState() + HikariConfig.getScheduledExecutorService() + HikariConfig.setScheduledExecutorService() + HikariConfig.isInitializationFailFast() + HikariConfig.setInitializationFailFast() + HikariConfig.isJdbc4ConnectionTest() + HikariConfig.setJdbc4ConnectionTest() + + HikariDataSource.copyState() + HikariDataSource.getScheduledExecutorService() + HikariDataSource.setScheduledExecutorService() + HikariDataSource.suspendPool() + HikariDataSource.resumePool() + HikariDataSource.shutdown() + HikariDataSource.isInitializationFailFast() + HikariDataSource.setInitializationFailFast() + HikariDataSource.isJdbc4ConnectionTest() + HikariDataSource.setJdbc4ConnectionTest() + + * pull 1110 add currently configured maxConnections and minConnections to pool metrics. + + * pull 1100 remove hard-coded percentiles for Micrometer metrics. + + * pull 1108 maintain a strong reference to PoolStats for Micrometer gauges to prevent premature + garbage collection. + + * pull 1098 update to Micrometer 1.0.0. + Changes in 2.7.8 * fixed 1095 fix breakage caused by sealed configuration with respect to special handling for the @@ -34,7 +65,7 @@ Changes in 2.7.5 * introduced the concept of a "sealed" configuration. Once a pool is started, attempts to alter its configuration outside of the HikariConfigMXBean will result in an IllegalStateException. - + Changes in 2.7.4 * pull 1026 added support for SQL Server's specific isolation level (SNAPSHOT). diff --git a/pom.xml b/pom.xml index 5c3616d7..edad85f8 100644 --- a/pom.xml +++ b/pom.xml @@ -29,7 +29,7 @@ com.zaxxer HikariCP - 2.7.9-SNAPSHOT + 3.0.0-SNAPSHOT bundle HikariCP diff --git a/src/main/java/com/zaxxer/hikari/HikariConfig.java b/src/main/java/com/zaxxer/hikari/HikariConfig.java index 9b99a445..d80b51a9 100644 --- a/src/main/java/com/zaxxer/hikari/HikariConfig.java +++ b/src/main/java/com/zaxxer/hikari/HikariConfig.java @@ -37,7 +37,6 @@ import java.util.Properties; import java.util.Set; import java.util.TreeSet; import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.ScheduledThreadPoolExecutor; import java.util.concurrent.ThreadFactory; import java.util.concurrent.ThreadLocalRandom; @@ -631,36 +630,6 @@ public class HikariConfig implements HikariConfigMXBean this.initializationFailTimeout = initializationFailTimeout; } - /** - * Get whether or not the construction of the pool should throw an exception - * if the minimum number of connections cannot be created. - * - * @return whether or not initialization should fail on error immediately - * @deprecated - */ - @Deprecated - public boolean isInitializationFailFast() - { - return initializationFailTimeout > 0; - } - - /** - * Set whether or not the construction of the pool should throw an exception - * if the minimum number of connections cannot be created. - * - * @param failFast true if the pool should fail if the minimum connections cannot be created - * @deprecated - */ - @Deprecated - public void setInitializationFailFast(boolean failFast) - { - if (sealed) throw new IllegalStateException("The configuration of the pool is sealed once started. Use HikariConfigMXBean for runtime changes."); - - LOGGER.warn("The initializationFailFast propery is deprecated, see initializationFailTimeout"); - - initializationFailTimeout = (failFast ? 1 : -1); - } - /** * Determine whether internal pool queries, principally aliveness checks, will be isolated in their own transaction * via {@link Connection#rollback()}. Defaults to {@code false}. @@ -685,20 +654,6 @@ public class HikariConfig implements HikariConfigMXBean this.isIsolateInternalQueries = isolate; } - @Deprecated - public boolean isJdbc4ConnectionTest() - { - return false; - } - - @Deprecated - public void setJdbc4ConnectionTest(boolean useIsValid) - { - if (sealed) throw new IllegalStateException("The configuration of the pool is sealed once started. Use HikariConfigMXBean for runtime changes."); - - LOGGER.warn("The jdbcConnectionTest property is now deprecated, see the documentation for connectionTestQuery"); - } - public MetricsTrackerFactory getMetricsTrackerFactory() { return metricsTrackerFactory; @@ -863,30 +818,6 @@ public class HikariConfig implements HikariConfigMXBean this.poolName = poolName; } - /** - * Get the ScheduledExecutorService used for housekeeping. - * - * @return the executor - */ - @Deprecated - public ScheduledThreadPoolExecutor getScheduledExecutorService() - { - return (ScheduledThreadPoolExecutor) scheduledExecutor; - } - - /** - * Set the ScheduledExecutorService used for housekeeping. - * - * @param executor the ScheduledExecutorService - */ - @Deprecated - public void setScheduledExecutorService(ScheduledThreadPoolExecutor executor) - { - if (sealed) throw new IllegalStateException("The configuration of the pool is sealed once started. Use HikariConfigMXBean for runtime changes."); - - this.scheduledExecutor = executor; - } - /** * Get the ScheduledExecutorService used for housekeeping. * @@ -974,20 +905,6 @@ public class HikariConfig implements HikariConfigMXBean this.sealed = true; } - /** - * Deprecated, use {@link #copyStateTo(HikariConfig)}. - *

- * Copies the state of {@code this} into {@code other}. - *

- * - * @param other Other {@link HikariConfig} to copy the state to. - */ - @Deprecated - public void copyState(HikariConfig other) - { - copyStateTo(other); - } - /** * Copies the state of {@code this} into {@code other}. * diff --git a/src/main/java/com/zaxxer/hikari/HikariDataSource.java b/src/main/java/com/zaxxer/hikari/HikariDataSource.java index 9f0c5ecd..bddad2b1 100644 --- a/src/main/java/com/zaxxer/hikari/HikariDataSource.java +++ b/src/main/java/com/zaxxer/hikari/HikariDataSource.java @@ -334,37 +334,6 @@ public class HikariDataSource extends HikariConfig implements DataSource, Closea } } - /** - * Suspend allocation of connections from the pool. All callers to getConnection() - * will block indefinitely until resumePool() is called. - * - * @deprecated Call the {@code HikariPoolMXBean#suspendPool()} method on the {@code HikariPoolMXBean} - * obtained by {@code #getHikariPoolMXBean()} or JMX lookup. - */ - @Deprecated - public void suspendPool() - { - HikariPool p; - if (!isClosed() && (p = pool) != null) { - p.suspendPool(); - } - } - - /** - * Resume allocation of connections from the pool. - * - * @deprecated Call the {@code HikariPoolMXBean#resumePool()} method on the {@code HikariPoolMXBean} - * obtained by {@code #getHikariPoolMXBean()} or JMX lookup. - */ - @Deprecated - public void resumePool() - { - HikariPool p; - if (!isClosed() && (p = pool) != null) { - p.resumePool(); - } - } - /** * Shutdown the DataSource and its associated pool. */ @@ -399,18 +368,6 @@ public class HikariDataSource extends HikariConfig implements DataSource, Closea return isShutdown.get(); } - /** - * Shutdown the DataSource and its associated pool. - * - * @deprecated This method has been deprecated, please use {@link #close()} instead - */ - @Deprecated - public void shutdown() - { - LOGGER.warn("The shutdown() method has been deprecated, please use the close() method instead"); - close(); - } - /** {@inheritDoc} */ @Override public String toString() diff --git a/src/main/java/com/zaxxer/hikari/HikariPoolMXBean.java b/src/main/java/com/zaxxer/hikari/HikariPoolMXBean.java index 22c3dbc0..a9d69ce3 100644 --- a/src/main/java/com/zaxxer/hikari/HikariPoolMXBean.java +++ b/src/main/java/com/zaxxer/hikari/HikariPoolMXBean.java @@ -16,24 +16,68 @@ package com.zaxxer.hikari; +import javax.sql.DataSource; + /** * The javax.management MBean for a Hikari pool instance. * * @author Brett Wooldridge */ -public interface HikariPoolMXBean +public interface HikariPoolMXBean { + /** + * Get the number of currently idle connections in the pool. The return value is extremely transient and is + * a point-in-time measurement. + * + * @return the current number of idle connections in the pool + */ int getIdleConnections(); + /** + * Get the number of currently active connections in the pool. The return value is extremely transient and is + * a point-in-time measurement. + * + * @return the current number of active (in-use) connections in the pool + */ int getActiveConnections(); + /** + * Get the total number of connections currently in the pool. The return value is transient and is a + * point-in-time measurement. + * + * @return the total number of connections in the pool + */ int getTotalConnections(); + /** + * Get the number of threads awaiting connections from the pool. The return value is extremely transient and is + * a point-in-time measurement. + * + * @return the number of threads awaiting a connection from the pool + */ int getThreadsAwaitingConnection(); + /** + * Evict currently idle connections from the pool, and mark active (in-use) connection for eviction when they are + * return to the pool. + */ void softEvictConnections(); + /** + * Suspend the pool. When the pool is suspended, threads calling {@link DataSource#getConnection()} will be + * blocked with no timeout until the pool is resumed via the {@link #resumePool()} method. + *

+ * This method has no effect unless the {@link HikariConfig#setAllowPoolSuspension(boolean)} method or equivalent + * property has been set to {@code true}. + */ void suspendPool(); + /** + * Resume the pool. Enables connection borrowing to resume on a pool that has been suspended via the + * {@link #suspendPool()} method. + *

+ * This method has no effect unless the {@link HikariConfig#setAllowPoolSuspension(boolean)} method or equivalent + * property has been set to {@code true}. + */ void resumePool(); }