bbotella commented on code in PR #223:
URL: 
https://github.com/apache/cassandra-analytics/pull/223#discussion_r4012915744


##########
cassandra-analytics-core/src/main/java/org/apache/cassandra/spark/bulkwriter/CassandraClusterInfo.java:
##########
@@ -138,6 +138,57 @@ public CassandraClusterInfo(BroadcastableClusterInfo 
broadcastable)
         this.allNodeSettingFutures = null;
     }
 
+    /**
+     * Creates a {@link CassandraClusterInfo} for a single cluster, selecting 
the concrete type based on the
+     * {@link BulkSparkConf#sidecarBehindLoadBalancer} flag.
+     *
+     * @param conf bulk write conf
+     * @return {@link LoadBalancedCassandraClusterInfo} when Sidecar is behind 
a load balancer, otherwise a plain
+     *         {@link CassandraClusterInfo}
+     */
+    public static CassandraClusterInfo create(BulkSparkConf conf)

Review Comment:
   Maybe a nit, but at least I'd like for us to consider.
   
   We are adding a new class `LoadBalancedCassandraClusterInfo` that extends 
`CassandraClusterInfo`, which is fine, but:
   `CassandraClusterInfo` may return an instance of itself or an instance of 
the new class, forcing it to "know" (depend) on 
`LoadBalancedCassandraClusterInfo`. This feels like a factory pattern with a 
potential abstract `CassandraClusterInfo` class and two classes extending it: 
`LoadBalancedCassandraClusterInfo` and maybe `StandaloneCassandraClusterInfo`, 
and the factory static create method returning one or the other? I think that 
approach would be cleaner. Opinions?



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