LuciferYang commented on code in PR #54476:
URL: https://github.com/apache/spark/pull/54476#discussion_r2851856541


##########
core/src/main/scala/org/apache/spark/deploy/security/HadoopDelegationTokenManager.scala:
##########
@@ -270,12 +272,19 @@ private[spark] class HadoopDelegationTokenManager(
     val providers = mutable.ArrayBuffer[HadoopDelegationTokenProvider]()
 
     val iterator = loader.iterator
-    while (iterator.hasNext) {
-      try {
-        providers += iterator.next
-      } catch {
-        case t: Throwable =>
-          logDebug(s"Failed to load built in provider.", t)
+    breakable {

Review Comment:
   ```
       var keepLoading = true
       while (keepLoading) {
         try {
           if (iterator.hasNext) {
             providers += iterator.next
           } else {
             keepLoading = false
           }
         } catch {
           case t: Throwable =>
             logDebug(s"Failed to load built in provider.", t)
         }
       }
   ```
   
   How about this? The `Breaks` feature will be deprecated in higher versions 
of Scala 3 (although it won't affect current code).



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to