patelh commented on a change in pull request #6419: Add ability to specify dbcp 
properties file
URL: https://github.com/apache/incubator-druid/pull/6419#discussion_r223814147
 
 

 ##########
 File path: 
server/src/main/java/org/apache/druid/metadata/SQLMetadataConnector.java
 ##########
 @@ -636,7 +638,21 @@ protected BasicDataSource getDatasource()
   {
     MetadataStorageConnectorConfig connectorConfig = getConfig();
 
-    BasicDataSource dataSource = new BasicDataSource();
+    BasicDataSource dataSource = null;
+
+    try {
+      Properties dbcpProperties = connectorConfig.getProperties();
+      if (dbcpProperties != null) {
+        dataSource = BasicDataSourceFactory.createDataSource(dbcpProperties);
+      } else {
+        dataSource = new BasicDataSource();
+      }
+    }
+    catch (Exception e) {
+      log.error(e, "Failed to create data source using dbcp properties file");
 
 Review comment:
   Trying to keep logging of error where it occurred.  I could have changed the 
signature of getDataSource() to throws Exception but that would entail changing 
all callers to handle the exception.  This felt like a smaller change by 
logging it and throwing runtime exception.  You want me to change signature and 
make changes to all the connectors ?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to