Repository: commons-dbcp Updated Branches: refs/heads/master 4627678be -> ad403802e
Format Javadoc. Project: http://git-wip-us.apache.org/repos/asf/commons-dbcp/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-dbcp/commit/ad403802 Tree: http://git-wip-us.apache.org/repos/asf/commons-dbcp/tree/ad403802 Diff: http://git-wip-us.apache.org/repos/asf/commons-dbcp/diff/ad403802 Branch: refs/heads/master Commit: ad403802e0a705e215b46cfaf4634bd674f6a3ce Parents: 4627678 Author: Gary Gregory <garydgreg...@gmail.com> Authored: Mon Jun 11 11:43:46 2018 -0600 Committer: Gary Gregory <garydgreg...@gmail.com> Committed: Mon Jun 11 11:43:46 2018 -0600 ---------------------------------------------------------------------- .../dbcp2/PoolableConnectionFactory.java | 92 +++++++++++--------- 1 file changed, 49 insertions(+), 43 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/commons-dbcp/blob/ad403802/src/main/java/org/apache/commons/dbcp2/PoolableConnectionFactory.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/commons/dbcp2/PoolableConnectionFactory.java b/src/main/java/org/apache/commons/dbcp2/PoolableConnectionFactory.java index a68155e..c3e5839 100644 --- a/src/main/java/org/apache/commons/dbcp2/PoolableConnectionFactory.java +++ b/src/main/java/org/apache/commons/dbcp2/PoolableConnectionFactory.java @@ -37,8 +37,7 @@ import org.apache.commons.pool2.impl.GenericKeyedObjectPoolConfig; import org.apache.commons.pool2.impl.DefaultPooledObject; /** - * A {@link PooledObjectFactory} that creates - * {@link PoolableConnection}s. + * A {@link PooledObjectFactory} that creates {@link PoolableConnection}s. * * @author Rodney Waldhoff * @author Glenn L. Nielsen @@ -46,16 +45,15 @@ import org.apache.commons.pool2.impl.DefaultPooledObject; * @author Dirk Verbeeck * @since 2.0 */ -public class PoolableConnectionFactory - implements PooledObjectFactory<PoolableConnection> { +public class PoolableConnectionFactory implements PooledObjectFactory<PoolableConnection> { - private static final Log log = - LogFactory.getLog(PoolableConnectionFactory.class); + private static final Log log = LogFactory.getLog(PoolableConnectionFactory.class); /** * Create a new {@code PoolableConnectionFactory}. - * @param connFactory the {@link ConnectionFactory} from which to obtain - * base {@link Connection}s + * + * @param connFactory + * the {@link ConnectionFactory} from which to obtain base {@link Connection}s */ public PoolableConnectionFactory(final ConnectionFactory connFactory, final ObjectName dataSourceJmxObjectName) { @@ -64,32 +62,33 @@ public class PoolableConnectionFactory } /** - * Sets the query I use to {@link #validateObject validate} {@link Connection}s. - * Should return at least one row. If not specified, - * {@link Connection#isValid(int)} will be used to validate connections. + * Sets the query I use to {@link #validateObject validate} {@link Connection}s. Should return at least one row. If + * not specified, {@link Connection#isValid(int)} will be used to validate connections. * - * @param validationQuery a query to use to {@link #validateObject validate} {@link Connection}s. + * @param validationQuery + * a query to use to {@link #validateObject validate} {@link Connection}s. */ public void setValidationQuery(final String validationQuery) { this.validationQuery = validationQuery; } /** - * Sets the validation query timeout, the amount of time, in seconds, that - * connection validation will wait for a response from the database when - * executing a validation query. Use a value less than or equal to 0 for - * no timeout. + * Sets the validation query timeout, the amount of time, in seconds, that connection validation will wait for a + * response from the database when executing a validation query. Use a value less than or equal to 0 for no timeout. * - * @param validationQueryTimeoutSeconds new validation query timeout value in seconds + * @param validationQueryTimeoutSeconds + * new validation query timeout value in seconds */ public void setValidationQueryTimeout(final int validationQueryTimeoutSeconds) { this.validationQueryTimeoutSeconds = validationQueryTimeoutSeconds; } /** - * Sets the SQL statements I use to initialize newly created {@link Connection}s. - * Using {@code null} turns off connection initialization. - * @param connectionInitSqls SQL statement to initialize {@link Connection}s. + * Sets the SQL statements I use to initialize newly created {@link Connection}s. Using {@code null} turns off + * connection initialization. + * + * @param connectionInitSqls + * SQL statement to initialize {@link Connection}s. */ public void setConnectionInitSql(final Collection<String> connectionInitSqls) { this.connectionInitSqls = connectionInitSqls; @@ -97,7 +96,9 @@ public class PoolableConnectionFactory /** * Sets the {@link ObjectPool} in which to pool {@link Connection}s. - * @param pool the {@link ObjectPool} in which to pool those {@link Connection}s + * + * @param pool + * the {@link ObjectPool} in which to pool those {@link Connection}s */ public synchronized void setPool(final ObjectPool<PoolableConnection> pool) { if(null != this.pool && pool != this.pool) { @@ -112,6 +113,7 @@ public class PoolableConnectionFactory /** * Returns the {@link ObjectPool} in which {@link Connection}s are pooled. + * * @return the connection pool */ public synchronized ObjectPool<PoolableConnection> getPool() { @@ -120,7 +122,9 @@ public class PoolableConnectionFactory /** * Sets the default "read only" setting for borrowed {@link Connection}s - * @param defaultReadOnly the default "read only" setting for borrowed {@link Connection}s + * + * @param defaultReadOnly + * the default "read only" setting for borrowed {@link Connection}s */ public void setDefaultReadOnly(final Boolean defaultReadOnly) { this.defaultReadOnly = defaultReadOnly; @@ -128,7 +132,9 @@ public class PoolableConnectionFactory /** * Sets the default "auto commit" setting for borrowed {@link Connection}s - * @param defaultAutoCommit the default "auto commit" setting for borrowed {@link Connection}s + * + * @param defaultAutoCommit + * the default "auto commit" setting for borrowed {@link Connection}s */ public void setDefaultAutoCommit(final Boolean defaultAutoCommit) { this.defaultAutoCommit = defaultAutoCommit; @@ -136,7 +142,9 @@ public class PoolableConnectionFactory /** * Sets the default "Transaction Isolation" setting for borrowed {@link Connection}s - * @param defaultTransactionIsolation the default "Transaction Isolation" setting for returned {@link Connection}s + * + * @param defaultTransactionIsolation + * the default "Transaction Isolation" setting for returned {@link Connection}s */ public void setDefaultTransactionIsolation(final int defaultTransactionIsolation) { this.defaultTransactionIsolation = defaultTransactionIsolation; @@ -144,7 +152,9 @@ public class PoolableConnectionFactory /** * Sets the default "catalog" setting for borrowed {@link Connection}s - * @param defaultCatalog the default "catalog" setting for borrowed {@link Connection}s + * + * @param defaultCatalog + * the default "catalog" setting for borrowed {@link Connection}s */ public void setDefaultCatalog(final String defaultCatalog) { this.defaultCatalog = defaultCatalog; @@ -168,10 +178,8 @@ public class PoolableConnectionFactory } /** - * Sets the maximum lifetime in milliseconds of a connection after which the - * connection will always fail activation, passivation and validation. A - * value of zero or less indicates an infinite lifetime. The default value - * is -1. + * Sets the maximum lifetime in milliseconds of a connection after which the connection will always fail activation, + * passivation and validation. A value of zero or less indicates an infinite lifetime. The default value is -1. */ public void setMaxConnLifetimeMillis(final long maxConnLifetimeMillis) { this.maxConnLifetimeMillis = maxConnLifetimeMillis; @@ -206,16 +214,15 @@ public class PoolableConnectionFactory /** * SQL_STATE codes considered to signal fatal conditions. * <p> - * Overrides the defaults in {@link Utils#DISCONNECTION_SQL_CODES} - * (plus anything starting with {@link Utils#DISCONNECTION_SQL_CODE_PREFIX}). - * If this property is non-null and {@link #isFastFailValidation()} is - * {@code true}, whenever connections created by this factory generate exceptions - * with SQL_STATE codes in this list, they will be marked as "fatally disconnected" - * and subsequent validations will fail fast (no attempt at isValid or validation - * query).</p> + * Overrides the defaults in {@link Utils#DISCONNECTION_SQL_CODES} (plus anything starting with + * {@link Utils#DISCONNECTION_SQL_CODE_PREFIX}). If this property is non-null and {@link #isFastFailValidation()} is + * {@code true}, whenever connections created by this factory generate exceptions with SQL_STATE codes in this list, + * they will be marked as "fatally disconnected" and subsequent validations will fail fast (no attempt at isValid or + * validation query). + * </p> * <p> - * If {@link #isFastFailValidation()} is {@code false} setting this property has no - * effect.</p> + * If {@link #isFastFailValidation()} is {@code false} setting this property has no effect. + * </p> * * @return SQL_STATE codes overriding defaults * @since 2.1 @@ -234,9 +241,8 @@ public class PoolableConnectionFactory } /** - * True means that validation will fail immediately for connections that - * have previously thrown SQLExceptions with SQL_STATE indicating fatal - * disconnection errors. + * True means that validation will fail immediately for connections that have previously thrown SQLExceptions with + * SQL_STATE indicating fatal disconnection errors. * * @return true if connections created by this factory will fast fail validation. * @see #setDisconnectionSqlCodes(Collection) @@ -248,8 +254,8 @@ public class PoolableConnectionFactory /** * @see #isFastFailValidation() - * @param fastFailValidation true means connections created by this factory will - * fast fail validation + * @param fastFailValidation + * true means connections created by this factory will fast fail validation * @since 2.1 */ public void setFastFailValidation(final boolean fastFailValidation) {