turcsanyip commented on code in PR #8619:
URL: https://github.com/apache/nifi/pull/8619#discussion_r1559652391


##########
nifi-nar-bundles/nifi-standard-services/nifi-hadoop-dbcp-service-bundle/nifi-hadoop-dbcp-service/src/main/java/org/apache/nifi/dbcp/HadoopDBCPConnectionPool.java:
##########
@@ -582,6 +409,41 @@ public void shutdown() throws SQLException {
         }
     }
 
+    @Override
+    protected Driver getDriver(String driverName, String url) {
+        return null;
+    }
+
+    @Override
+    protected DataSourceConfiguration 
getDataSourceConfiguration(ConfigurationContext context) {
+        final String url = 
context.getProperty(DATABASE_URL).evaluateAttributeExpressions().getValue();
+        final String driverName = 
context.getProperty(DB_DRIVERNAME).evaluateAttributeExpressions().getValue();
+        final String user = 
context.getProperty(DB_USER).evaluateAttributeExpressions().getValue();
+        final String password = 
context.getProperty(DB_PASSWORD).evaluateAttributeExpressions().getValue();
+        final Integer maxTotal = 
context.getProperty(MAX_TOTAL_CONNECTIONS).evaluateAttributeExpressions().asInteger();
+        final String validationQuery = 
context.getProperty(VALIDATION_QUERY).evaluateAttributeExpressions().getValue();
+        final Long maxWaitMillis = 
extractMillisWithInfinite(context.getProperty(MAX_WAIT_TIME).evaluateAttributeExpressions());
+        final Integer minIdle = 
context.getProperty(MIN_IDLE).evaluateAttributeExpressions().asInteger();
+        final Integer maxIdle = 
context.getProperty(MAX_IDLE).evaluateAttributeExpressions().asInteger();
+        final Long maxConnLifetimeMillis = 
extractMillisWithInfinite(context.getProperty(MAX_CONN_LIFETIME).evaluateAttributeExpressions());
+        final Long timeBetweenEvictionRunsMillis = 
extractMillisWithInfinite(context.getProperty(EVICTION_RUN_PERIOD).evaluateAttributeExpressions());
+        final Long minEvictableIdleTimeMillis = 
extractMillisWithInfinite(context.getProperty(MIN_EVICTABLE_IDLE_TIME).evaluateAttributeExpressions());
+        final Long softMinEvictableIdleTimeMillis = 
extractMillisWithInfinite(context.getProperty(SOFT_MIN_EVICTABLE_IDLE_TIME).evaluateAttributeExpressions());
+
+        return new DataSourceConfiguration.Builder(url, driverName, user, 
password)
+                .validationQuery(validationQuery)
+                .driverClassLoader(this.getClass().getClassLoader())

Review Comment:
   I see it comes from the old implementation but instead of setting the 
`ClassLoader`, the `Driver` could be initialized in this class (similar to 
[DBCPConnectionPool.getDriver()](https://github.com/apache/nifi/blob/90d0f6317a94d1730f779b719398c6a384fb9033/nifi-nar-bundles/nifi-standard-services/nifi-dbcp-service-bundle/nifi-dbcp-service/src/main/java/org/apache/nifi/dbcp/DBCPConnectionPool.java#L288-L312)).
   In this case, `AbstractDBCPConnectionPool` and `DataSourceConfiguration` do 
not need to be changed.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to