frankgh commented on code in PR #9:
URL: https://github.com/apache/cassandra-analytics/pull/9#discussion_r1246965210


##########
cassandra-analytics-core/src/main/java/org/apache/cassandra/spark/bulkwriter/CassandraClusterInfo.java:
##########
@@ -338,11 +339,23 @@ public String getVersionFromFeature()
 
     public String getVersionFromSidecar()
     {
-        LOGGER.info("Getting Cassandra versions from all nodes");
-        List<NodeSettings> allNodeSettings = 
Sidecar.allNodeSettingsBlocking(conf,
-                                                                             
cassandraContext.getSidecarClient(),
-                                                                             
cassandraContext.clusterConfig);
-        return getLowestVersion(allNodeSettings);
+        List<NodeSettings> currentAllNodeSettings = allNodeSettings;
+        if (currentAllNodeSettings != null)
+        {
+            return getLowestVersion(currentAllNodeSettings);
+        }
+
+        synchronized (this)
+        {
+            if (allNodeSettings == null)
+            {
+                LOGGER.info("Getting Cassandra versions from all nodes");
+                allNodeSettings = Sidecar.allNodeSettingsBlocking(conf,
+                                                                  
cassandraContext.getSidecarClient(),
+                                                                  
cassandraContext.clusterConfig);
+            }
+            return getLowestVersion(allNodeSettings);

Review Comment:
   To me, the [original implementation provided in the 
PR](https://github.com/apache/cassandra-analytics/commit/10725fb9f29076637eb2e9a9206d97287b239bc7)
 is the correct* classic double checked locking pattern. By some definition of 
correct



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