psalagnac commented on code in PR #4538:
URL: https://github.com/apache/solr/pull/4538#discussion_r3491849428


##########
solr/solrj/src/java/org/apache/solr/common/cloud/DocCollection.java:
##########
@@ -23,20 +23,22 @@
 import java.time.Instant;
 import java.util.ArrayList;
 import java.util.Collection;
-import java.util.HashMap;
+import java.util.Collections;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Objects;
 import java.util.concurrent.atomic.AtomicReference;
 import java.util.function.BiConsumer;
+import java.util.function.Function;
 import java.util.function.Supplier;
+import java.util.stream.Collectors;
+import net.jcip.annotations.Immutable;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-/**
- * Models a Collection in zookeeper (but that Java name is obviously taken, 
hence "DocCollection")
- */
+/** A Solr Collection; it's state/metadata. */
+@Immutable

Review Comment:
   I would comment it is still not fully immutable when using PRS



##########
solr/solrj/src/java/org/apache/solr/common/cloud/DocCollection.java:
##########
@@ -268,6 +272,11 @@ public DocCollection copyWithSlices(Map<String, Slice> 
slices) {
     return result;
   }
 
+  @Override
+  public Map<String, Object> getProperties() {
+    return Collections.unmodifiableMap(super.getProperties());

Review Comment:
   From the Javadoc of the parent class, it is supposed to be already 
immutable. In practice, maybe it is not...
   
   What about making `ZkNodeProps` actually immutable instead of override this?



##########
solr/solrj/src/java/org/apache/solr/common/cloud/DocCollection.java:
##########
@@ -268,6 +272,11 @@ public DocCollection copyWithSlices(Map<String, Slice> 
slices) {
     return result;
   }
 
+  @Override
+  public Map<String, Object> getProperties() {
+    return Collections.unmodifiableMap(super.getProperties());

Review Comment:
   Hmmm... I see code in `ExclusiveSliceProperty` that updates this list.



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