JeetKunDoug commented on code in PR #14:
URL: 
https://github.com/apache/cassandra-analytics/pull/14#discussion_r1343176314


##########
cassandra-analytics-core/src/main/java/org/apache/cassandra/spark/validation/StartupValidator.java:
##########
@@ -33,18 +34,18 @@
 public final class StartupValidator
 {
     private static final Logger LOGGER = 
LoggerFactory.getLogger(StartupValidator.class);
-    private static final StartupValidator INSTANCE = new StartupValidator();
+    private static final ThreadLocal<StartupValidator> INSTANCE = 
ThreadLocal.withInitial(StartupValidator::new);
     private static final String DISABLE = "SKIP_STARTUP_VALIDATIONS";
 
-    private final List<StartupValidation> validations = new ArrayList<>();
+    private final List<StartupValidation> validations = 
Collections.synchronizedList(new ArrayList<>());

Review Comment:
   The fact of the matter is that it's now wrapped in a ThreadLocal so it 
shouldn't really _need_ to be synchronized anyway, but we decided to do this as 
an additional guarantee to make sure that it couldn't really be updated from 
multiple threads... the number of accesses to this validation collection is 
like 3 times per thread so I think this is reasonable.



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