tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject svn commit: r1828067 - /tomcat/trunk/java/org/apache/tomcat/dbcp/dbcp2/BasicDataSourceFactory.java
Date Fri, 30 Mar 2018 14:48:54 GMT
Author: remm
Date: Fri Mar 30 14:48:54 2018
New Revision: 1828067

URL: http://svn.apache.org/viewvc?rev=1828067&view=rev
Log:
Make it possible to extend the BasicDataSource object factory without having to copy everything.

Modified:
    tomcat/trunk/java/org/apache/tomcat/dbcp/dbcp2/BasicDataSourceFactory.java

Modified: tomcat/trunk/java/org/apache/tomcat/dbcp/dbcp2/BasicDataSourceFactory.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/dbcp/dbcp2/BasicDataSourceFactory.java?rev=1828067&r1=1828066&r2=1828067&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/dbcp/dbcp2/BasicDataSourceFactory.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/dbcp/dbcp2/BasicDataSourceFactory.java Fri Mar 30
14:48:54 2018
@@ -335,8 +335,21 @@ public class BasicDataSourceFactory impl
      * @return the data source instance
      * @throws Exception if an error occurs creating the data source
      */
-    public static BasicDataSource createDataSource(final Properties properties) throws Exception
{
+    public BasicDataSource createDataSource(final Properties properties) throws Exception
{
         final BasicDataSource dataSource = new BasicDataSource();
+        configureDataSource(dataSource, properties);
+        return dataSource;
+    }
+
+    /**
+     * Configures a {@link BasicDataSource} instance based on the
+     * given properties.
+     *
+     * @param properties the datasource configuration properties
+     * @param dataSource the data source instance
+     * @throws Exception if an error occurs creating the data source
+     */
+    public void configureDataSource(final BasicDataSource dataSource, final Properties properties)
throws Exception {
         String value = null;
 
         value = properties.getProperty(PROP_DEFAULTAUTOCOMMIT);
@@ -595,9 +608,6 @@ public class BasicDataSourceFactory impl
         if (dataSource.getInitialSize() > 0) {
             dataSource.getLogWriter();
         }
-
-        // Return the configured DataSource instance
-        return dataSource;
     }
 
     /**



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message