This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-dbcp.git


The following commit(s) were added to refs/heads/master by this push:
     new 5770324  Sort methods.
5770324 is described below

commit 5770324f8af51f54ecd46979b804b6c9d5fdfb42
Author: Gary Gregory <garydgreg...@gmail.com>
AuthorDate: Mon Aug 10 16:06:14 2020 -0400

    Sort methods.
---
 .../org/apache/commons/dbcp2/BasicDataSource.java  | 142 ++++++++++-----------
 1 file changed, 71 insertions(+), 71 deletions(-)

diff --git a/src/main/java/org/apache/commons/dbcp2/BasicDataSource.java 
b/src/main/java/org/apache/commons/dbcp2/BasicDataSource.java
index 97c17f7..4acecaf 100644
--- a/src/main/java/org/apache/commons/dbcp2/BasicDataSource.java
+++ b/src/main/java/org/apache/commons/dbcp2/BasicDataSource.java
@@ -425,55 +425,6 @@ public class BasicDataSource implements DataSource, 
BasicDataSourceMXBean, MBean
     }
 
     /**
-     * Starts the datasource.
-     * <p>
-     * It is not necessary to call this method before using a newly created 
BasicDataSource instance, but
-     * calling it in that context causes the datasource to be immediately 
initialized (instead of waiting for
-     * the first {@link #getConnection()} request). Its primary use is to 
restart and reinitialize a
-     * datasource that has been closed.
-     * <p>
-     * When this method is called after {@link #close()}, connections checked 
out by clients
-     * before the datasource was stopped do not count in {@link 
#getMaxTotal()} or {@link #getNumActive()}.
-     * For example, if there are 3 connections checked out by clients when 
{@link #close()} is invoked and they are
-     * not returned before {@link #start()} is invoked, after this method is 
called, {@link #getNumActive()} will
-     * return 0.  These connections will be physically closed when they are 
returned, but they will not count against
-     * the maximum allowed in the newly started datasource.
-     *
-     * @throws SQLException if an error occurs initializing the datasource
-     */
-    @Override
-    public synchronized void start() throws SQLException {
-        closed = false;
-        createDataSource();
-    }
-
-    /**
-     * Restarts the datasource.
-     * <p>
-     * This method calls {@link #close()} and {@link #start()} in sequence 
within synchronized scope so any
-     * connection requests that come in while the datsource is shutting down 
will be served by the new pool.
-     * <p>
-     * Idle connections that are stored in the connection pool when this 
method is invoked are closed, but
-     * connections that are checked out to clients when this method is invoked 
are not affected. When client
-     * applications subsequently invoke {@link Connection#close()} to return 
these connections to the pool, the
-     * underlying JDBC connections are closed. These connections do not count 
in {@link #getMaxTotal()} or
-     * {@link #getNumActive()} after invoking this method. For example, if 
there are 3 connections checked out by
-     * clients when {@link #restart()} is invoked, after this method is 
called, {@link #getNumActive()} will
-     * return 0 and up to {@link #getMaxTotal()} + 3 connections may be open 
until the connections sourced from
-     * the original pool are returned.
-     * <p>
-     * The new connection pool created by this method is initialized with 
currently set configuration properties.
-     *
-     * @throws SQLException if an error occurs initializing the datasource
-     */
-    @Override
-    public synchronized void restart() throws SQLException {
-        close();
-        start();
-    }
-
-
-    /**
      * Closes the connection pool, silently swallowing any exception that 
occurs.
      */
     private void closeConnectionPool() {
@@ -512,6 +463,7 @@ public class BasicDataSource implements DataSource, 
BasicDataSourceMXBean, MBean
         return ConnectionFactoryFactory.createConnectionFactory(this, 
DriverFactory.createDriver(this));
     }
 
+
     /**
      * Creates a connection pool for this datasource. This method only exists 
so subclasses can replace the
      * implementation class.
@@ -1485,6 +1437,17 @@ public class BasicDataSource implements DataSource, 
BasicDataSourceMXBean, MBean
     }
 
     /**
+     * Returns true if the statement pool is cleared when the connection is 
returned to its pool.
+     * 
+     * @return true if the statement pool is cleared at connection return 
+     * @since 2.8.0
+     */
+    @Override
+    public boolean isClearStatementPoolOnReturn() {
+        return clearStatementPoolOnReturn;
+    }
+
+    /**
      * If true, this data source is closed and no more connections can be 
retrieved from this data source.
      *
      * @return true, if the data source is closed; false otherwise
@@ -1514,17 +1477,6 @@ public class BasicDataSource implements DataSource, 
BasicDataSourceMXBean, MBean
         return this.poolPreparedStatements;
     }
 
-    /**
-     * Returns true if the statement pool is cleared when the connection is 
returned to its pool.
-     * 
-     * @return true if the statement pool is cleared at connection return 
-     * @since 2.8.0
-     */
-    @Override
-    public boolean isClearStatementPoolOnReturn() {
-        return clearStatementPoolOnReturn;
-    }
-
     @Override
     public boolean isWrapperFor(final Class<?> iface) throws SQLException {
         return false;
@@ -1609,6 +1561,31 @@ public class BasicDataSource implements DataSource, 
BasicDataSourceMXBean, MBean
     }
 
     /**
+     * Restarts the datasource.
+     * <p>
+     * This method calls {@link #close()} and {@link #start()} in sequence 
within synchronized scope so any
+     * connection requests that come in while the datsource is shutting down 
will be served by the new pool.
+     * <p>
+     * Idle connections that are stored in the connection pool when this 
method is invoked are closed, but
+     * connections that are checked out to clients when this method is invoked 
are not affected. When client
+     * applications subsequently invoke {@link Connection#close()} to return 
these connections to the pool, the
+     * underlying JDBC connections are closed. These connections do not count 
in {@link #getMaxTotal()} or
+     * {@link #getNumActive()} after invoking this method. For example, if 
there are 3 connections checked out by
+     * clients when {@link #restart()} is invoked, after this method is 
called, {@link #getNumActive()} will
+     * return 0 and up to {@link #getMaxTotal()} + 3 connections may be open 
until the connections sourced from
+     * the original pool are returned.
+     * <p>
+     * The new connection pool created by this method is initialized with 
currently set configuration properties.
+     *
+     * @throws SQLException if an error occurs initializing the datasource
+     */
+    @Override
+    public synchronized void restart() throws SQLException {
+        close();
+        start();
+    }
+
+    /**
      * Sets the print writer to be used by this configuration to log 
information on abandoned objects.
      *
      * @param logWriter The new log writer
@@ -1683,6 +1660,17 @@ public class BasicDataSource implements DataSource, 
BasicDataSourceMXBean, MBean
     }
 
     /**
+     * Sets whether the pool of statements (which was enabled with {@link 
#setPoolPreparedStatements(boolean)}) should 
+     * be cleared when the connection is returned to its pool. Default is 
false.
+     * 
+     * @param clearStatementPoolOnReturn clear or not
+     * @since 2.8.0
+     */
+    public void setClearStatementPoolOnReturn(final boolean 
clearStatementPoolOnReturn) {
+        this.clearStatementPoolOnReturn = clearStatementPoolOnReturn;
+    }
+
+    /**
      * Sets the ConnectionFactory class name.
      *
      * @param connectionFactoryClassName A class name.
@@ -2217,17 +2205,6 @@ public class BasicDataSource implements DataSource, 
BasicDataSourceMXBean, MBean
     }
 
     /**
-     * Sets whether the pool of statements (which was enabled with {@link 
#setPoolPreparedStatements(boolean)}) should 
-     * be cleared when the connection is returned to its pool. Default is 
false.
-     * 
-     * @param clearStatementPoolOnReturn clear or not
-     * @since 2.8.0
-     */
-    public void setClearStatementPoolOnReturn(final boolean 
clearStatementPoolOnReturn) {
-        this.clearStatementPoolOnReturn = clearStatementPoolOnReturn;
-    }
-
-    /**
      * @param removeAbandonedOnBorrow true means abandoned connections may be 
removed when connections are borrowed from
      *                                the pool.
      * @see #getRemoveAbandonedOnBorrow()
@@ -2439,6 +2416,29 @@ public class BasicDataSource implements DataSource, 
BasicDataSourceMXBean, MBean
     }
 
     /**
+     * Starts the datasource.
+     * <p>
+     * It is not necessary to call this method before using a newly created 
BasicDataSource instance, but
+     * calling it in that context causes the datasource to be immediately 
initialized (instead of waiting for
+     * the first {@link #getConnection()} request). Its primary use is to 
restart and reinitialize a
+     * datasource that has been closed.
+     * <p>
+     * When this method is called after {@link #close()}, connections checked 
out by clients
+     * before the datasource was stopped do not count in {@link 
#getMaxTotal()} or {@link #getNumActive()}.
+     * For example, if there are 3 connections checked out by clients when 
{@link #close()} is invoked and they are
+     * not returned before {@link #start()} is invoked, after this method is 
called, {@link #getNumActive()} will
+     * return 0.  These connections will be physically closed when they are 
returned, but they will not count against
+     * the maximum allowed in the newly started datasource.
+     *
+     * @throws SQLException if an error occurs initializing the datasource
+     */
+    @Override
+    public synchronized void start() throws SQLException {
+        closed = false;
+        createDataSource();
+    }
+
+    /**
      * Starts the connection pool maintenance task, if configured.
      */
     protected void startPoolMaintenance() {

Reply via email to