lhotari opened a new issue, #25782:
URL: https://github.com/apache/pulsar/issues/25782

   The existing code (before this PR) unnecessarily uses TreeMap as parameter, 
field, or variable types. A general recommendation is to use the minimal Map 
interface type, usually one of `java.util.Map`, `java.util.SequencedMap`, or 
`java.util.SortedMap`. In the case of connectors, the use the TreeMap is 
justified as the implementation to get stable iteration order by key. This is 
available when `java.util.Map` is the parameter, field, or variable type.
   
   I'd suggest addressing the refactoring to get rid of unnecessary use of 
TreeMap in parameter, field, and variable types for connector related classes 
after this current PR has been merged. For example,
   
   In ConnectorsManager
   ```java
       @Getter
       private volatile Map<String, Connector> connectors;
   ```
   
   The implementation instance would remain as `TreeMap`, so this change would 
only be about the types for fields, variables and parameters.
   
   
   ```java
   public record ReloadConnectorsResult(Map<String, Connector> connectors, 
List<Connector> connectorsToClose) {
   }
   ```
   
   This change could also be made part of this PR since it already closes 
touches the code where `TreeMap` is used and also adds a new `TreeMap` 
parameter/field in ReloadConnectorsResult.
   
   _Originally posted by @lhotari in 
https://github.com/apache/pulsar/pull/25773#pullrequestreview-4296345007_
               


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