maedhroz commented on code in PR #4848:
URL: https://github.com/apache/cassandra/pull/4848#discussion_r3320174327
##########
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:
I think we do want to fail here, and the behavior really isn't changed at
all when you consider that `load()` didn't really throw anyway.
--
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]