From fc4f9a99ccce49d57c8da1ecd42ed263efdf2ee1 Mon Sep 17 00:00:00 2001 From: Yanming Zhou Date: Tue, 24 Sep 2024 09:29:09 +0800 Subject: [PATCH] Polishing Javadoc suggested by IDEA --- .../java/com/zaxxer/hikari/HikariConfig.java | 52 +++++++++---------- .../com/zaxxer/hikari/HikariConfigMXBean.java | 6 +-- .../com/zaxxer/hikari/HikariDataSource.java | 16 +++--- .../com/zaxxer/hikari/HikariPoolMXBean.java | 14 ++--- .../zaxxer/hikari/SQLExceptionOverride.java | 4 +- .../hibernate/HikariConnectionProvider.java | 2 +- .../com/zaxxer/hikari/metrics/PoolStats.java | 2 +- .../dropwizard/CodahaleHealthChecker.java | 4 +- .../com/zaxxer/hikari/pool/HikariPool.java | 22 ++++---- .../java/com/zaxxer/hikari/pool/PoolBase.java | 10 ++-- .../com/zaxxer/hikari/pool/ProxyLeakTask.java | 2 +- .../hikari/pool/ProxyLeakTaskFactory.java | 2 +- .../zaxxer/hikari/pool/ProxyResultSet.java | 2 +- .../com/zaxxer/hikari/util/ClockSource.java | 4 +- .../com/zaxxer/hikari/util/ConcurrentBag.java | 30 +++++------ .../zaxxer/hikari/util/DriverDataSource.java | 4 +- .../java/com/zaxxer/hikari/util/FastList.java | 4 +- .../hikari/util/JavassistProxyFactory.java | 6 +-- .../zaxxer/hikari/util/SuspendResumeLock.java | 2 +- .../com/zaxxer/hikari/util/UtilityElf.java | 2 +- .../com/zaxxer/hikari/util/TestFastList.java | 2 +- 21 files changed, 96 insertions(+), 96 deletions(-) diff --git a/src/main/java/com/zaxxer/hikari/HikariConfig.java b/src/main/java/com/zaxxer/hikari/HikariConfig.java index f0cc081c..3a6eb1c1 100644 --- a/src/main/java/com/zaxxer/hikari/HikariConfig.java +++ b/src/main/java/com/zaxxer/hikari/HikariConfig.java @@ -145,9 +145,9 @@ public class HikariConfig implements HikariConfigMXBean } /** - * Construct a HikariConfig from the specified property file name. propertyFileName + * Construct a HikariConfig from the specified property file name. propertyFileName * will first be treated as a path in the file-system, and if that fails the - * Class.getResourceAsStream(propertyFileName) will be tried. + * Class.getResourceAsStream(propertyFileName) will be tried. * * @param propertyFileName the name of the property file */ @@ -397,7 +397,7 @@ public class HikariConfig implements HikariConfigMXBean /** * Set the SQL string that will be executed on all new connections when they are - * created, before they are added to the pool. If this query fails, it will be + * created, before they are added to the pool. If this query fails, it will be * treated as a failed connection attempt. * * @param connectionInitSql the SQL to execute on new connections @@ -420,7 +420,7 @@ public class HikariConfig implements HikariConfigMXBean } /** - * Set a {@link DataSource} for the pool to explicitly wrap. This setter is not + * Set a {@link DataSource} for the pool to explicitly wrap. This setter is not * available through property file based initialization. * * @param dataSource a specific {@link DataSource} to be wrapped by the pool @@ -456,7 +456,7 @@ public class HikariConfig implements HikariConfigMXBean * Add a property (name/value pair) that will be used to configure the {@link DataSource}/{@link java.sql.Driver}. *

* In the case of a {@link DataSource}, the property names will be translated to Java setters following the Java Bean - * naming convention. For example, the property {@code cachePrepStmts} will translate into {@code setCachePrepStmts()} + * naming convention. For example, the property {@code cachePrepStmts} will translate into {@code setCachePrepStmts()} * with the {@code value} passed as a parameter. *

* In the case of a {@link java.sql.Driver}, the property will be added to a {@link Properties} instance that will @@ -568,8 +568,8 @@ public class HikariConfig implements HikariConfigMXBean } /** - * Set whether or not pool suspension is allowed. There is a performance - * impact when pool suspension is enabled. Unless you need it (for a + * Set whether pool suspension is allowed. There is a performance + * impact when pool suspension is enabled. Unless you need it (for a * redundancy system for example) do not enable it. * * @param isAllowPoolSuspension the desired pool suspension allowance @@ -581,7 +581,7 @@ public class HikariConfig implements HikariConfigMXBean } /** - * Get the pool initialization failure timeout. See {@code #setInitializationFailTimeout(long)} + * Get the pool initialization failure timeout. See {@code #setInitializationFailTimeout(long)} * for details. * * @return the number of milliseconds before the pool initialization fails @@ -593,32 +593,32 @@ public class HikariConfig implements HikariConfigMXBean } /** - * Set the pool initialization failure timeout. This setting applies to pool + * Set the pool initialization failure timeout. This setting applies to pool * initialization when {@link HikariDataSource} is constructed with a {@link HikariConfig}, * or when {@link HikariDataSource} is constructed using the no-arg constructor * and {@link HikariDataSource#getConnection()} is called. *

* Note that if this timeout value is greater than or equal to zero (0), and therefore an * initial connection validation is performed, this timeout does not override the * {@code connectionTimeout} or {@code validationTimeout}; they will be honored before this - * timeout is applied. The default value is one millisecond. + * timeout is applied. The default value is one millisecond. * * @param initializationFailTimeout the number of milliseconds before the * pool initialization fails, or 0 to validate connection setup but continue with @@ -633,7 +633,7 @@ public class HikariConfig implements HikariConfigMXBean /** * Determine whether internal pool queries, principally aliveness checks, will be isolated in their own transaction - * via {@link Connection#rollback()}. Defaults to {@code false}. + * via {@link Connection#rollback()}. Defaults to {@code false}. * * @return {@code true} if internal pool queries are isolated, {@code false} if not */ @@ -644,7 +644,7 @@ public class HikariConfig implements HikariConfigMXBean /** * Configure whether internal pool queries, principally aliveness checks, will be isolated in their own transaction - * via {@link Connection#rollback()}. Defaults to {@code false}. + * via {@link Connection#rollback()}. Defaults to {@code false}. * * @param isolate {@code true} if internal pool queries should be isolated, {@code false} if not */ @@ -669,7 +669,7 @@ public class HikariConfig implements HikariConfigMXBean } /** - * Get the MetricRegistry instance to use for registration of metrics used by HikariCP. Default is {@code null}. + * Get the MetricRegistry instance to use for registration of metrics used by HikariCP. Default is {@code null}. * * @return the MetricRegistry instance that will be used */ @@ -702,7 +702,7 @@ public class HikariConfig implements HikariConfigMXBean } /** - * Get the HealthCheckRegistry that will be used for registration of health checks by HikariCP. Currently only + * Get the HealthCheckRegistry that will be used for registration of health checks by HikariCP. Currently only * Codahale/DropWizard is supported for health checks. * * @return the HealthCheckRegistry instance that will be used @@ -713,8 +713,8 @@ public class HikariConfig implements HikariConfigMXBean } /** - * Set the HealthCheckRegistry that will be used for registration of health checks by HikariCP. Currently only - * Codahale/DropWizard is supported for health checks. Default is {@code null}. + * Set the HealthCheckRegistry that will be used for registration of health checks by HikariCP. Currently only + * Codahale/DropWizard is supported for health checks. Default is {@code null}. * * @param healthCheckRegistry the HealthCheckRegistry to be used */ @@ -821,7 +821,7 @@ public class HikariConfig implements HikariConfigMXBean } /** - * Set the name of the connection pool. This is primarily used in logging and JMX management consoles + * Set the name of the connection pool. This is primarily used in logging and JMX management consoles * to identify pools and pool configurations * * @param poolName the name of the connection pool to use @@ -951,8 +951,8 @@ public class HikariConfig implements HikariConfigMXBean } /** - * Set the default transaction isolation level. The specified value is the - * constant name from the Connection class, eg. + * Set the default transaction isolation level. The specified value is the + * constant name from the Connection class, for example: * TRANSACTION_REPEATABLE_READ. * * @param isolationLevel the name of the isolation level @@ -1143,7 +1143,7 @@ public class HikariConfig implements HikariConfigMXBean LOGGER.warn("{} - idleTimeout is less than 10000ms, setting to default {}ms.", poolName, IDLE_TIMEOUT); idleTimeout = IDLE_TIMEOUT; } - else if (idleTimeout != IDLE_TIMEOUT && idleTimeout != 0 && minIdle == maxPoolSize) { + else if (idleTimeout != IDLE_TIMEOUT && idleTimeout != 0 && minIdle == maxPoolSize) { LOGGER.warn("{} - idleTimeout has been set but has no effect because the pool is operating as a fixed size pool.", poolName); } } diff --git a/src/main/java/com/zaxxer/hikari/HikariConfigMXBean.java b/src/main/java/com/zaxxer/hikari/HikariConfigMXBean.java index 10539114..f1f71a72 100644 --- a/src/main/java/com/zaxxer/hikari/HikariConfigMXBean.java +++ b/src/main/java/com/zaxxer/hikari/HikariConfigMXBean.java @@ -19,7 +19,7 @@ package com.zaxxer.hikari; import com.zaxxer.hikari.util.Credentials; /** - * The javax.management MBean for a Hikari pool configuration. + * The {@code javax.management} MBean for a Hikari pool configuration. * * @author Brett Wooldridge */ @@ -116,7 +116,7 @@ public interface HikariConfigMXBean /** * The property controls the minimum number of idle connections that HikariCP tries to maintain in the pool, * including both idle and in-use connections. If the idle connections dip below this value, HikariCP will - * make a best effort to restore them quickly and efficiently. + * make the best effort to restore them quickly and efficiently. * * @return the minimum number of connections in the pool */ @@ -125,7 +125,7 @@ public interface HikariConfigMXBean /** * The property controls the minimum number of idle connections that HikariCP tries to maintain in the pool, * including both idle and in-use connections. If the idle connections dip below this value, HikariCP will - * make a best effort to restore them quickly and efficiently. + * make the best effort to restore them quickly and efficiently. * * @param minIdle the minimum number of idle connections in the pool to maintain */ diff --git a/src/main/java/com/zaxxer/hikari/HikariDataSource.java b/src/main/java/com/zaxxer/hikari/HikariDataSource.java index 335a438b..3cf2b0bc 100644 --- a/src/main/java/com/zaxxer/hikari/HikariDataSource.java +++ b/src/main/java/com/zaxxer/hikari/HikariDataSource.java @@ -47,12 +47,12 @@ public class HikariDataSource extends HikariConfig implements DataSource, Closea private volatile HikariPool pool; /** - * Default constructor. Setters are used to configure the pool. Using + * Default constructor. Setters are used to configure the pool. Using * this constructor vs. {@link #HikariDataSource(HikariConfig)} will * result in {@link #getConnection()} performance that is slightly lower * due to lazy initialization checks. - * - * The first call to {@link #getConnection()} starts the pool. Once the pool + *

+ * The first call to {@link #getConnection()} starts the pool. Once the pool * is started, the configuration is "sealed" and no further configuration * changes are possible -- except via {@link HikariConfigMXBean} methods. */ @@ -62,10 +62,10 @@ public class HikariDataSource extends HikariConfig implements DataSource, Closea } /** - * Construct a HikariDataSource with the specified configuration. The + * Construct a HikariDataSource with the specified configuration. The * {@link HikariConfig} is copied and the pool is started by invoking this * constructor. - * + *

* The {@link HikariConfig} can be modified without affecting the HikariDataSource * and used to initialize another HikariDataSource instance. * @@ -297,7 +297,7 @@ public class HikariDataSource extends HikariConfig implements DataSource, Closea } /** - * Get the {@code HikariPoolMXBean} for this HikariDataSource instance. If this method is called on + * Get the {@code HikariPoolMXBean} for this HikariDataSource instance. If this method is called on * a {@code HikariDataSource} that has been constructed without a {@code HikariConfig} instance, * and before an initial call to {@code #getConnection()}, the return value will be {@code null}. * @@ -319,9 +319,9 @@ public class HikariDataSource extends HikariConfig implements DataSource, Closea } /** - * Evict a connection from the pool. If the connection has already been closed (returned to the pool) + * Evict a connection from the pool. If the connection has already been closed (returned to the pool) * this may result in a "soft" eviction; the connection will be evicted sometime in the future if it is - * currently in use. If the connection has not been closed, the eviction is immediate. + * currently in use. If the connection has not been closed, the eviction is immediate. * * @param connection the connection to evict from the pool */ diff --git a/src/main/java/com/zaxxer/hikari/HikariPoolMXBean.java b/src/main/java/com/zaxxer/hikari/HikariPoolMXBean.java index bdc8a07a..47eb0b29 100644 --- a/src/main/java/com/zaxxer/hikari/HikariPoolMXBean.java +++ b/src/main/java/com/zaxxer/hikari/HikariPoolMXBean.java @@ -19,7 +19,7 @@ package com.zaxxer.hikari; import javax.sql.DataSource; /** - * The javax.management MBean for a Hikari pool instance. + * The {@code javax.management} MBean for a Hikari pool instance. * * @author Brett Wooldridge */ @@ -28,7 +28,7 @@ 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. Therefore, due to a time + * The return value is extremely transient and is a point-in-time measurement. Therefore, due to a time * difference between invoking this method and {@link #getActiveConnections()}, it is possible for the sum * of idle plus active connections to be either less than or greater than the value returned by * {@link #getTotalConnections()}. @@ -40,7 +40,7 @@ public interface HikariPoolMXBean /** * Get the number of currently active connections in the pool. *

- * The return value is extremely transient and is a point-in-time measurement. Therefore, due to a time + * The return value is extremely transient and is a point-in-time measurement. Therefore, due to a time * difference between invoking this method and {@link #getIdleConnections()}, it is possible for the sum * of idle plus active connections to be either less than or greater than the value returned by * {@link #getTotalConnections()}. @@ -50,7 +50,7 @@ public interface HikariPoolMXBean int getActiveConnections(); /** - * Get the total number of connections currently in the pool. The return value is transient and is a + * 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 @@ -58,7 +58,7 @@ public interface HikariPoolMXBean int getTotalConnections(); /** - * Get the number of threads awaiting connections from the pool. The return value is extremely transient and is + * 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 @@ -72,7 +72,7 @@ public interface HikariPoolMXBean void softEvictConnections(); /** - * Suspend the pool. When the pool is suspended, threads calling {@link DataSource#getConnection()} will be + * 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 @@ -81,7 +81,7 @@ public interface HikariPoolMXBean void suspendPool(); /** - * Resume the pool. Enables connection borrowing to resume on a pool that has been suspended via the + * 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 diff --git a/src/main/java/com/zaxxer/hikari/SQLExceptionOverride.java b/src/main/java/com/zaxxer/hikari/SQLExceptionOverride.java index 17168d8e..d5e48cb4 100644 --- a/src/main/java/com/zaxxer/hikari/SQLExceptionOverride.java +++ b/src/main/java/com/zaxxer/hikari/SQLExceptionOverride.java @@ -4,9 +4,9 @@ import java.sql.SQLException; /** * Users can implement this interface to override the default SQLException handling - * of HikariCP. By the time an instance of this interface is invoked HikariCP has + * of HikariCP. By the time an instance of this interface is invoked HikariCP has * already made a determination to evict the Connection from the pool. - * + *

* If the {@link #adjudicate(SQLException)} method returns {@link Override#CONTINUE_EVICT} the eviction will occur, but if the * method returns {@link Override#DO_NOT_EVICT} the eviction will be elided. */ diff --git a/src/main/java/com/zaxxer/hikari/hibernate/HikariConnectionProvider.java b/src/main/java/com/zaxxer/hikari/hibernate/HikariConnectionProvider.java index 4f9656c4..ffea3d5d 100644 --- a/src/main/java/com/zaxxer/hikari/hibernate/HikariConnectionProvider.java +++ b/src/main/java/com/zaxxer/hikari/hibernate/HikariConnectionProvider.java @@ -68,7 +68,7 @@ public class HikariConnectionProvider implements ConnectionProvider, Configurabl this.hds = null; if (Version.getVersionString().substring(0, 5).compareTo("4.3.6") >= 1) { LOGGER.warn("com.zaxxer.hikari.hibernate.HikariConnectionProvider has been deprecated for versions of " - + "Hibernate 4.3.6 and newer. Please switch to org.hibernate.hikaricp.internal.HikariCPConnectionProvider."); + + "Hibernate 4.3.6 and newer. Please switch to org.hibernate.hikaricp.internal.HikariCPConnectionProvider."); } } diff --git a/src/main/java/com/zaxxer/hikari/metrics/PoolStats.java b/src/main/java/com/zaxxer/hikari/metrics/PoolStats.java index 8fb4ed08..1c693369 100644 --- a/src/main/java/com/zaxxer/hikari/metrics/PoolStats.java +++ b/src/main/java/com/zaxxer/hikari/metrics/PoolStats.java @@ -109,5 +109,5 @@ public abstract class PoolStats return true; } } - } + } } diff --git a/src/main/java/com/zaxxer/hikari/metrics/dropwizard/CodahaleHealthChecker.java b/src/main/java/com/zaxxer/hikari/metrics/dropwizard/CodahaleHealthChecker.java index c46f9f81..be6b8718 100644 --- a/src/main/java/com/zaxxer/hikari/metrics/dropwizard/CodahaleHealthChecker.java +++ b/src/main/java/com/zaxxer/hikari/metrics/dropwizard/CodahaleHealthChecker.java @@ -28,13 +28,13 @@ import java.sql.SQLException; import java.util.concurrent.TimeUnit; /** - * Provides Dropwizard HealthChecks. Two health checks are provided: + * Provides Dropwizard HealthChecks. Two health checks are provided: *

* The ConnectivityCheck will use the connectionTimeout, unless the health check property - * connectivityCheckTimeoutMs is defined. However, if either the connectionTimeout + * connectivityCheckTimeoutMs is defined. However, if either the connectionTimeout * or the connectivityCheckTimeoutMs is 0 (infinite), a timeout of 10 seconds will be used. *

* The Connection99Percent health check will only be registered if the health check property diff --git a/src/main/java/com/zaxxer/hikari/pool/HikariPool.java b/src/main/java/com/zaxxer/hikari/pool/HikariPool.java index ae97e403..b04ee3a4 100644 --- a/src/main/java/com/zaxxer/hikari/pool/HikariPool.java +++ b/src/main/java/com/zaxxer/hikari/pool/HikariPool.java @@ -276,7 +276,7 @@ public final class HikariPool extends PoolBase implements HikariPoolMXBean, IBag } /** - * Set a metrics registry to be used when registering metrics collectors. The HikariDataSource prevents this + * Set a metrics registry to be used when registering metrics collectors. The HikariDataSource prevents this * method from being called more than once. * * @param metricRegistry the metrics registry instance to use @@ -311,7 +311,7 @@ public final class HikariPool extends PoolBase implements HikariPoolMXBean, IBag } /** - * Set the health check registry to be used when registering health checks. Currently only Codahale health + * Set the health check registry to be used when registering health checks. Currently only Codahale health * checks are supported. * * @param healthCheckRegistry the health check registry instance to use @@ -470,7 +470,7 @@ public final class HikariPool extends PoolBase implements HikariPoolMXBean, IBag // *********************************************************************** /** - * Creating new poolEntry. If maxLifetime is configured, create a future End-of-life task with 2.5% variance from + * Creating new poolEntry. If maxLifetime is configured, create a future End-of-life task with 2.5% variance from * the maxLifetime time to ensure there is no massive die-off of Connections in the pool. */ private PoolEntry createPoolEntry() @@ -603,11 +603,11 @@ public final class HikariPool extends PoolBase implements HikariPoolMXBean, IBag } /** - * "Soft" evict a Connection (/PoolEntry) from the pool. If this method is being called by the user directly + * "Soft" evict a Connection (/PoolEntry) from the pool. If this method is being called by the user directly * through {@link com.zaxxer.hikari.HikariDataSource#evictConnection(Connection)} then {@code owner} is {@code true}. - * + *

* If the caller is the owner, or if the Connection is idle (i.e. can be "reserved" in the {@link ConcurrentBag}), - * then we can close the connection immediately. Otherwise, we leave it "marked" for eviction so that it is evicted + * then we can close the connection immediately. Otherwise, we leave it "marked" for eviction so that it is evicted * the next time someone tries to acquire it from the pool. * * @param poolEntry the PoolEntry (/Connection) to "soft" evict from the pool @@ -627,8 +627,8 @@ public final class HikariPool extends PoolBase implements HikariPoolMXBean, IBag } /** - * Create/initialize the Housekeeping service {@link ScheduledExecutorService}. If the user specified an Executor - * to be used in the {@link HikariConfig}, then we use that. If no Executor was specified (typical), then create + * Create/initialize the Housekeeping service {@link ScheduledExecutorService}. If the user specified an Executor + * to be used in the {@link HikariConfig}, then we use that. If no Executor was specified (typical), then create * an Executor and configure it. * * @return either the user specified {@link ScheduledExecutorService}, or the one we created @@ -679,11 +679,11 @@ public final class HikariPool extends PoolBase implements HikariPoolMXBean, IBag /** * Create a timeout exception (specifically, {@link SQLTransientConnectionException}) to be thrown, because a - * timeout occurred when trying to acquire a Connection from the pool. If there was an underlying cause for the + * timeout occurred when trying to acquire a Connection from the pool. If there was an underlying cause for the * timeout, e.g. a SQLException thrown by the driver while trying to create a new Connection, then use the * SQL State from that exception as our own and additionally set that exception as the "next" SQLException inside * our exception. - * + *

* As a side effect, log the timeout failure at DEBUG, and record the timeout failure in the metrics tracker. * * @param startTime the start time (timestamp) of the acquisition attempt @@ -769,7 +769,7 @@ public final class HikariPool extends PoolBase implements HikariPoolMXBean, IBag /** * We only create connections if we need another idle connection or have threads still waiting - * for a new connection. Otherwise we bail out of the request to create. + * for a new connection. Otherwise, we bail out of the request to create. * * @return true if we should create a connection, false if the need has disappeared */ diff --git a/src/main/java/com/zaxxer/hikari/pool/PoolBase.java b/src/main/java/com/zaxxer/hikari/pool/PoolBase.java index 6ce3b616..f5e7ac36 100644 --- a/src/main/java/com/zaxxer/hikari/pool/PoolBase.java +++ b/src/main/java/com/zaxxer/hikari/pool/PoolBase.java @@ -347,7 +347,7 @@ abstract class PoolBase /** * Obtain connection from data source. * - * @return a Connection connection + * @return a connection */ private Connection newConnection() throws Exception { @@ -388,7 +388,7 @@ abstract class PoolBase } /** - * Setup a connection initial state. + * Set up a connection initial state. * * @param connection a Connection * @throws ConnectionSetupException thrown if any exception is encountered @@ -517,7 +517,7 @@ abstract class PoolBase /** * Set the network timeout, if isUseNetworkTimeout is true and the - * driver supports it. Return the pre-existing value of the network timeout. + * driver supports it. Return the pre-existing value of the network timeout. * * @param connection the connection to set the network timeout on * @param timeoutMs the number of milliseconds before timeout @@ -630,7 +630,7 @@ abstract class PoolBase /** * This will create a string for debug logging. Given a set of "reset bits", this * method will return a concatenated string, for example: - * + *

* Input : 0b00110 * Output: "autoCommit, isolation" * @@ -700,7 +700,7 @@ abstract class PoolBase } /** - * A class that delegates to a MetricsTracker implementation. The use of a delegate + * A class that delegates to a MetricsTracker implementation. The use of a delegate * allows us to use the NopMetricsTrackerDelegate when metrics are disabled, which in * turn allows the JIT to completely optimize away to callsites to record metrics. */ diff --git a/src/main/java/com/zaxxer/hikari/pool/ProxyLeakTask.java b/src/main/java/com/zaxxer/hikari/pool/ProxyLeakTask.java index f61f723b..2db3550f 100644 --- a/src/main/java/com/zaxxer/hikari/pool/ProxyLeakTask.java +++ b/src/main/java/com/zaxxer/hikari/pool/ProxyLeakTask.java @@ -24,7 +24,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** - * A Runnable that is scheduled in the future to report leaks. The ScheduledFuture is + * A Runnable that is scheduled in the future to report leaks. The ScheduledFuture is * cancelled if the connection is closed before the leak time expires. * * @author Brett Wooldridge diff --git a/src/main/java/com/zaxxer/hikari/pool/ProxyLeakTaskFactory.java b/src/main/java/com/zaxxer/hikari/pool/ProxyLeakTaskFactory.java index 9eafdcc6..8a7f3426 100644 --- a/src/main/java/com/zaxxer/hikari/pool/ProxyLeakTaskFactory.java +++ b/src/main/java/com/zaxxer/hikari/pool/ProxyLeakTaskFactory.java @@ -26,7 +26,7 @@ import java.util.concurrent.ScheduledExecutorService; */ class ProxyLeakTaskFactory { - private ScheduledExecutorService executorService; + private final ScheduledExecutorService executorService; private long leakDetectionThreshold; ProxyLeakTaskFactory(final long leakDetectionThreshold, final ScheduledExecutorService executorService) diff --git a/src/main/java/com/zaxxer/hikari/pool/ProxyResultSet.java b/src/main/java/com/zaxxer/hikari/pool/ProxyResultSet.java index 286c1dc5..3e9bffce 100644 --- a/src/main/java/com/zaxxer/hikari/pool/ProxyResultSet.java +++ b/src/main/java/com/zaxxer/hikari/pool/ProxyResultSet.java @@ -56,7 +56,7 @@ public abstract class ProxyResultSet implements ResultSet /** {@inheritDoc} */ @Override - public final Statement getStatement() throws SQLException + public final Statement getStatement() { return statement; } diff --git a/src/main/java/com/zaxxer/hikari/util/ClockSource.java b/src/main/java/com/zaxxer/hikari/util/ClockSource.java index 6d024504..58ced107 100644 --- a/src/main/java/com/zaxxer/hikari/util/ClockSource.java +++ b/src/main/java/com/zaxxer/hikari/util/ClockSource.java @@ -34,7 +34,7 @@ import java.util.concurrent.TimeUnit; */ public interface ClockSource { - static ClockSource CLOCK = Factory.create(); + ClockSource CLOCK = Factory.create(); /** * Get the current time-stamp (resolution is opaque). @@ -142,7 +142,7 @@ public interface ClockSource /** * Get the TimeUnit the ClockSource is denominated in. - * @return + * @return the TimeUnit */ static TimeUnit getSourceTimeUnit() { return CLOCK.getSourceTimeUnit0(); diff --git a/src/main/java/com/zaxxer/hikari/util/ConcurrentBag.java b/src/main/java/com/zaxxer/hikari/util/ConcurrentBag.java index 971cb8d7..1e7dcbe5 100644 --- a/src/main/java/com/zaxxer/hikari/util/ConcurrentBag.java +++ b/src/main/java/com/zaxxer/hikari/util/ConcurrentBag.java @@ -39,17 +39,17 @@ import static java.util.concurrent.locks.LockSupport.parkNanos; /** * This is a specialized concurrent bag that achieves superior performance * to LinkedBlockingQueue and LinkedTransferQueue for the purposes of a - * connection pool. It uses ThreadLocal storage when possible to avoid + * connection pool. It uses ThreadLocal storage when possible to avoid * locks, but resorts to scanning a common collection if there are no - * available items in the ThreadLocal list. Not-in-use items in the + * available items in the ThreadLocal list. Not-in-use items in the * ThreadLocal lists can be "stolen" when the borrowing thread has none - * of its own. It is a "lock-less" implementation using a specialized + * of its own. It is a "lock-less" implementation using a specialized * AbstractQueuedLongSynchronizer to manage cross-thread signaling. *

* Note that items that are "borrowed" from the bag are not actually * removed from any collection, so garbage collection will not occur - * even if the reference is abandoned. Thus care must be taken to - * "requite" borrowed objects otherwise a memory leak will result. Only + * even if the reference is abandoned. Thus care must be taken to + * "requite" borrowed objects otherwise a memory leak will result. Only * the "remove" method can completely remove an object from the bag. * * @author Brett Wooldridge @@ -164,7 +164,7 @@ public class ConcurrentBag implements AutoCloseab } /** - * This method will return a borrowed object to the bag. Objects + * This method will return a borrowed object to the bag. Objects * that are borrowed from the bag but never "requited" will result * in a memory leak. * @@ -215,7 +215,7 @@ public class ConcurrentBag implements AutoCloseab } /** - * Remove a value from the bag. This method should only be called + * Remove a value from the bag. This method should only be called * with objects obtained by borrow(long, TimeUnit) or reserve(T) * * @param bagEntry the value to remove @@ -251,8 +251,8 @@ public class ConcurrentBag implements AutoCloseab /** * This method provides a "snapshot" in time of the BagEntry - * items in the bag in the specified state. It does not "lock" - * or reserve items in any way. Call reserve(T) + * items in the bag in the specified state. It does not "lock" + * or reserve items in any way. Call reserve(T) * on items in list before performing any action on them. * * @param state one of the {@link IConcurrentBagEntry} states @@ -266,8 +266,8 @@ public class ConcurrentBag implements AutoCloseab } /** - * This method provides a "snapshot" in time of the bag items. It - * does not "lock" or reserve items in any way. Call reserve(T) + * This method provides a "snapshot" in time of the bag items. It + * does not "lock" or reserve items in any way. Call reserve(T) * on items in the list, or understand the concurrency implications of * modifying items, before performing any action on them. * @@ -281,15 +281,15 @@ public class ConcurrentBag implements AutoCloseab /** * The method is used to make an item in the bag "unavailable" for - * borrowing. It is primarily used when wanting to operate on items - * returned by the values(int) method. Items that are + * borrowing. It is primarily used when wanting to operate on items + * returned by the values(int) method. Items that are * reserved can be removed from the bag via remove(T) - * without the need to unreserve them. Items that are not removed + * without the need to unreserve them. Items that are not removed * from the bag can be make available for borrowing again by calling * the unreserve(T) method. * * @param bagEntry the item to reserve - * @return true if the item was able to be reserved, false otherwise + * @return true if the item is able to reserve, false otherwise */ public boolean reserve(final T bagEntry) { diff --git a/src/main/java/com/zaxxer/hikari/util/DriverDataSource.java b/src/main/java/com/zaxxer/hikari/util/DriverDataSource.java index fe7f908c..2e47d245 100644 --- a/src/main/java/com/zaxxer/hikari/util/DriverDataSource.java +++ b/src/main/java/com/zaxxer/hikari/util/DriverDataSource.java @@ -152,13 +152,13 @@ public final class DriverDataSource implements DataSource } @Override - public void setLoginTimeout(int seconds) throws SQLException + public void setLoginTimeout(int seconds) { DriverManager.setLoginTimeout(seconds); } @Override - public int getLoginTimeout() throws SQLException + public int getLoginTimeout() { return DriverManager.getLoginTimeout(); } diff --git a/src/main/java/com/zaxxer/hikari/util/FastList.java b/src/main/java/com/zaxxer/hikari/util/FastList.java index ef384a42..70626537 100644 --- a/src/main/java/com/zaxxer/hikari/util/FastList.java +++ b/src/main/java/com/zaxxer/hikari/util/FastList.java @@ -105,7 +105,7 @@ public final class FastList implements List, RandomAccess, Serializable } /** - * Remove the last element from the list. No bound check is performed, so if this + * Remove the last element from the list. No bound check is performed, so if this * method is called on an empty list and ArrayIndexOutOfBounds exception will be * thrown. * @@ -120,7 +120,7 @@ public final class FastList implements List, RandomAccess, Serializable /** * This remove method is most efficient when the element being removed - * is the last element. Equality is identity based, not equals() based. + * is the last element. Equality is identity based, not equals() based. * Only the first matching element is removed. * * @param element the element to remove diff --git a/src/main/java/com/zaxxer/hikari/util/JavassistProxyFactory.java b/src/main/java/com/zaxxer/hikari/util/JavassistProxyFactory.java index 534ce7cb..cb0d5982 100644 --- a/src/main/java/com/zaxxer/hikari/util/JavassistProxyFactory.java +++ b/src/main/java/com/zaxxer/hikari/util/JavassistProxyFactory.java @@ -30,7 +30,7 @@ import java.util.Set; /** * This class generates the proxy objects for {@link Connection}, {@link Statement}, - * {@link PreparedStatement}, and {@link CallableStatement}. Additionally it injects + * {@link PreparedStatement}, and {@link CallableStatement}. Additionally, it injects * method bodies into the {@link ProxyFactory} class methods that can instantiate * instances of the generated proxies. * @@ -100,7 +100,7 @@ public final class JavassistProxyFactory } /** - * Generate Javassist Proxy Classes + * Generate Javassist Proxy Classes */ private static void generateProxyClass(Class primaryInterface, String superClassName, String methodBody) throws Exception { @@ -186,7 +186,7 @@ public final class JavassistProxyFactory } } catch (NotFoundException e) { - // fall thru + // fall through } return false; diff --git a/src/main/java/com/zaxxer/hikari/util/SuspendResumeLock.java b/src/main/java/com/zaxxer/hikari/util/SuspendResumeLock.java index 222e4055..0af5cfd6 100644 --- a/src/main/java/com/zaxxer/hikari/util/SuspendResumeLock.java +++ b/src/main/java/com/zaxxer/hikari/util/SuspendResumeLock.java @@ -21,7 +21,7 @@ import java.sql.SQLTransientException; import java.util.concurrent.Semaphore; /** - * This class implements a lock that can be used to suspend and resume the pool. It + * This class implements a lock that can be used to suspend and resume the pool. It * also provides a faux implementation that is used when the feature is disabled that * hopefully gets fully "optimized away" by the JIT. * diff --git a/src/main/java/com/zaxxer/hikari/util/UtilityElf.java b/src/main/java/com/zaxxer/hikari/util/UtilityElf.java index d149a9e6..47e12e76 100644 --- a/src/main/java/com/zaxxer/hikari/util/UtilityElf.java +++ b/src/main/java/com/zaxxer/hikari/util/UtilityElf.java @@ -43,7 +43,7 @@ public final class UtilityElf /** * - * @return null if string is null or empty, , trimmed string otherwise + * @return null if string is null or empty, trimmed string otherwise */ public static String getNullIfEmpty(final String text) { diff --git a/src/test/java/com/zaxxer/hikari/util/TestFastList.java b/src/test/java/com/zaxxer/hikari/util/TestFastList.java index 8a91b2b2..af7ba822 100644 --- a/src/test/java/com/zaxxer/hikari/util/TestFastList.java +++ b/src/test/java/com/zaxxer/hikari/util/TestFastList.java @@ -106,7 +106,7 @@ public class TestFastList } Iterator iter = list.iterator(); - for (int i = 0; i < list.size(); i++) { + for (int i = 0; i < list.size(); i++) { assertSame(list.get(i), iter.next()); } }