wu-sheng commented on a change in pull request #770: Decouple JDBCURL parser 
logic from URLParser question
URL: 
https://github.com/apache/incubator-skywalking/pull/770#discussion_r170424666
 
 

 ##########
 File path: 
apm-sniffer/apm-sdk-plugin/jdbc-commons/src/main/java/org/apache/skywalking/apm/plugin/jdbc/connectionurl/parser/URLParser.java
 ##########
 @@ -29,22 +33,36 @@
  */
 public class URLParser {
 
-    private static final String MYSQL_JDBC_URL_PREFIX = "jdbc:mysql";
-    private static final String ORACLE_JDBC_URL_PREFIX = "jdbc:oracle";
-    private static final String H2_JDBC_URL_PREFIX = "jdbc:h2";
-    private static final String POSTGRESQL_JDBC_URL_PREFIX = "jdbc:postgresql";
+    private static ServiceLoader<ConnectionURLParser> JDBCPARSERS
+        = ServiceLoader.load(ConnectionURLParser.class, URLParser.class
+        .getClassLoader());
 
 Review comment:
   I have concern about using ServiceLoader by 
`URLParser.class.getClassLoader()`. I think this didn't work in real world. 
Because the parser implementations, including service define files are in 
plugin-*.jar, which can't access by any default or webapp classloader.
   
   I think the only way is using ClassLoader from `AgentClassLoader#getDefault` 
could work.

----------------------------------------------------------------
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

Reply via email to