fantapsody commented on code in PR #16138:
URL: https://github.com/apache/pulsar/pull/16138#discussion_r901415236


##########
pulsar-common/src/main/java/org/apache/pulsar/common/util/FieldParser.java:
##########
@@ -212,7 +212,7 @@ public static <T> void setEmptyValue(String strValue, Field 
field, T obj)
             if (field.getType().equals(List.class)) {
                 field.set(obj, new ArrayList<>());
             } else if (field.getType().equals(Set.class)) {
-                field.set(obj, new HashSet<>());
+                field.set(obj, new LinkedHashSet<>());

Review Comment:
   It's true for new configuration fields. However, using `Set` ensures the 
uniqueness of the elements in the collection, so it's non-trivial to convert 
the type of these fields from `Set` to `List`, and there are quite a few 
existing configuration fields of the type `Set`. On the other hand, changing 
`HashSet` to `LinkedHashSet` makes all existing fields ordered and it seems 
harmless except for a bit increase in the per-element memory consumption which 
should be acceptable for configuration items.



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

Reply via email to