You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@kyuubi.apache.org by "bowenliang123 (via GitHub)" <gi...@apache.org> on 2023/05/30 10:28:35 UTC

[GitHub] [kyuubi] bowenliang123 opened a new pull request, #4905: Generalize util method for loading class from service loader

bowenliang123 opened a new pull request, #4905:
URL: https://github.com/apache/kyuubi/pull/4905

   <!--
   Thanks for sending a pull request!
   
   Here are some tips for you:
     1. If this is your first time, please read our contributor guidelines: https://kyuubi.readthedocs.io/en/latest/community/CONTRIBUTING.html
     2. If the PR is related to an issue in https://github.com/apache/kyuubi/issues, add '[KYUUBI #XXXX]' in your PR title, e.g., '[KYUUBI #XXXX] Your PR title ...'.
     3. If the PR is unfinished, add '[WIP]' in your PR title, e.g., '[WIP][KYUUBI #XXXX] Your PR title ...'.
   -->
   
   ### _Why are the changes needed?_
   <!--
   Please clarify why the changes are needed. For instance,
     1. If you add a feature, you can talk about the use case of it.
     2. If you fix a bug, you can clarify why it is a bug.
   -->
   
   
   ### _How was this patch tested?_
   - [ ] Add some test cases that check the changes thoroughly including negative and positive cases if possible
   
   - [ ] Add screenshots for manual tests if appropriate
   
   - [ ] [Run test](https://kyuubi.readthedocs.io/en/master/develop_tools/testing.html#running-tests) locally before make a pull request
   


-- 
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: notifications-unsubscribe@kyuubi.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


[GitHub] [kyuubi] bowenliang123 commented on pull request #4905: Generalize util method for loading class from service loader

Posted by "bowenliang123 (via GitHub)" <gi...@apache.org>.
bowenliang123 commented on PR #4905:
URL: https://github.com/apache/kyuubi/pull/4905#issuecomment-1570156935

   Thanks, merged to master.


-- 
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: notifications-unsubscribe@kyuubi.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


[GitHub] [kyuubi] bowenliang123 commented on a diff in pull request #4905: Generalize util method for loading class from service loader

Posted by "bowenliang123 (via GitHub)" <gi...@apache.org>.
bowenliang123 commented on code in PR #4905:
URL: https://github.com/apache/kyuubi/pull/4905#discussion_r1210317136


##########
externals/kyuubi-jdbc-engine/src/main/scala/org/apache/kyuubi/engine/jdbc/connection/ConnectionProvider.scala:
##########
@@ -69,27 +69,12 @@ abstract class AbstractConnectionProvider extends Logging {
     selectedProvider.getConnection(kyuubiConf)
   }
 
-  def loadProviders(): Seq[JdbcConnectionProvider] = {
-    val loader = ServiceLoader.load(
-      classOf[JdbcConnectionProvider],
-      Thread.currentThread().getContextClassLoader)
-    val providers = ArrayBuffer[JdbcConnectionProvider]()
-
-    val iterator = loader.iterator()
-    while (iterator.hasNext) {
-      try {
-        val provider = iterator.next()
+  def loadProviders(): Seq[JdbcConnectionProvider] =
+    loadClassFromServiceLoader[JdbcConnectionProvider]()
+      .map { provider =>
         info(s"Loaded provider: $provider")
-        providers += provider
-      } catch {
-        case t: Throwable =>
-          warn(s"Loaded of the provider failed with the exception", t)
-      }
-    }
-
-    // TODO support disable provider
-    providers
-  }
+        provider
+      }.toSeq

Review Comment:
   Could you have a look at this change? Trying to simplify the loading and looping of JdbcConnectionProvider. And skipping the warning message as there's no instance construction and no possible thrown exception.
   
   cc @zhouyifan279 



-- 
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: notifications-unsubscribe@kyuubi.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


[GitHub] [kyuubi] codecov-commenter commented on pull request #4905: Generalize util method for loading class from service loader

Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #4905:
URL: https://github.com/apache/kyuubi/pull/4905#issuecomment-1568829745

   ## [Codecov](https://app.codecov.io/gh/apache/kyuubi/pull/4905?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   > Merging [#4905](https://app.codecov.io/gh/apache/kyuubi/pull/4905?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) (1193641) into [master](https://app.codecov.io/gh/apache/kyuubi/commit/1e3eff69dbc80d5d9a47b4ac7de31bd3d35d9796?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) (1e3eff6) will **not change** coverage.
   > The diff coverage is `0.00%`.
   
   ```diff
   @@          Coverage Diff           @@
   ##           master   #4905   +/-   ##
   ======================================
     Coverage    0.00%   0.00%           
   ======================================
     Files         557     557           
     Lines       30695   30686    -9     
     Branches     3994    3993    -1     
   ======================================
   + Misses      30695   30686    -9     
   ```
   
   
   | [Impacted Files](https://app.codecov.io/gh/apache/kyuubi/pull/4905?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
   |---|---|---|
   | [...ache/kyuubi/plugin/spark/authz/serde/package.scala](https://app.codecov.io/gh/apache/kyuubi/pull/4905?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-ZXh0ZW5zaW9ucy9zcGFyay9reXV1Ymktc3BhcmstYXV0aHovc3JjL21haW4vc2NhbGEvb3JnL2FwYWNoZS9reXV1YmkvcGx1Z2luL3NwYXJrL2F1dGh6L3NlcmRlL3BhY2thZ2Uuc2NhbGE=) | `0.00% <0.00%> (ø)` | |
   | [...che/kyuubi/events/handler/EventHandlerLoader.scala](https://app.codecov.io/gh/apache/kyuubi/pull/4905?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-a3l1dWJpLWV2ZW50cy9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL2t5dXViaS9ldmVudHMvaGFuZGxlci9FdmVudEhhbmRsZXJMb2FkZXIuc2NhbGE=) | `0.00% <0.00%> (ø)` | |
   | [.../kyuubi/credentials/HadoopCredentialsManager.scala](https://app.codecov.io/gh/apache/kyuubi/pull/4905?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-a3l1dWJpLXNlcnZlci9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL2t5dXViaS9jcmVkZW50aWFscy9IYWRvb3BDcmVkZW50aWFsc01hbmFnZXIuc2NhbGE=) | `0.00% <0.00%> (ø)` | |
   | [...pache/kyuubi/engine/KyuubiApplicationManager.scala](https://app.codecov.io/gh/apache/kyuubi/pull/4905?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-a3l1dWJpLXNlcnZlci9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL2t5dXViaS9lbmdpbmUvS3l1dWJpQXBwbGljYXRpb25NYW5hZ2VyLnNjYWxh) | `0.00% <0.00%> (ø)` | |
   
   :mega: We’re building smart automated test selection to slash your CI/CD build times. [Learn more](https://about.codecov.io/iterative-testing/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
   


-- 
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: notifications-unsubscribe@kyuubi.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


[GitHub] [kyuubi] bowenliang123 closed pull request #4905: Generalize util method for loading class from service loader

Posted by "bowenliang123 (via GitHub)" <gi...@apache.org>.
bowenliang123 closed pull request #4905: Generalize util method for loading class from service loader
URL: https://github.com/apache/kyuubi/pull/4905


-- 
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: notifications-unsubscribe@kyuubi.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org