netudima commented on code in PR #4848:
URL: https://github.com/apache/cassandra/pull/4848#discussion_r3320124172


##########
src/java/org/apache/cassandra/service/StartupChecks.java:
##########
@@ -156,29 +156,24 @@ public StartupChecks withDefaultTests()
 
     public StartupChecks withServiceLoaderTests()
     {
-        ServiceLoader<StartupCheck> loader;
+        Set<StartupCheck> customChecks = new HashSet<>();
+        Set<String> uniqueNames = new HashSet<>();
+        Set<String> duplicitNames = new HashSet<>();
 
         try
         {
-            loader = ServiceLoader.load(StartupCheck.class);
+            for (StartupCheck check : ServiceLoader.load(StartupCheck.class))
+            {
+                if (!uniqueNames.add(check.name()))
+                    duplicitNames.add(check.name());
+                else
+                    customChecks.add(check);
+            }
         }
         catch (ServiceConfigurationError t)
         {
-            logger.warn("Unable to get startup checks via ServiceLoader. " +
-                        "Custom checks will not be triggered. Reason: " + 
t.getMessage());
-            return this;
-        }
-
-        Set<StartupCheck> customChecks = new HashSet<>();
-        Set<String> uniqueNames = new HashSet<>();
-        Set<String> duplicitNames = new HashSet<>();
-
-        for (StartupCheck check : loader)
-        {
-            if (!uniqueNames.add(check.name()))
-                duplicitNames.add(check.name());
-            else
-                customChecks.add(check);
+            throw new ConfigurationException("Unable to get startup checks via 
ServiceLoader. " +

Review Comment:
   According to the ticket description the plan is to fix exception catching by 
moving the loader using logic within the try/catch block but in this current 
version we start to throw the exception instead of ignoring it with a warn 
message. 
   Is the goal to ignore the loading error or just fail with a better error 
message? (in other words: what is correct - the implementation or the ticket 
description?)



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