pivotal-jbarrett commented on a change in pull request #5905:
URL: https://github.com/apache/geode/pull/5905#discussion_r561408566



##########
File path: 
geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/CommandInitializer.java
##########
@@ -111,37 +89,76 @@
  * @since GemFire 5.7
  */
 
-public class CommandInitializer {
+public class CommandInitializer implements CommandRegistry {
 
-  @Immutable
-  static final Map<KnownVersion, Map<Integer, Command>> ALL_COMMANDS = 
initializeAllCommands();
+  @Deprecated
+  @MakeNotStatic
+  static final CommandInitializer instance = new CommandInitializer();
 
   /**
-   * Register a new command with the system.
+   * Gets legacy singleton instance.
+   *
+   * @deprecated Efforts should be made to get and instance from the cache or 
other object.
    *
-   * @param messageType - An ordinal for this message. This must be something 
defined in MessageType
-   *        that has not already been allocated to a different command.
-   * @param versionToNewCommand The command to register, for different 
versions. The key is the
-   *        earliest version for which this command class is valid (starting 
with GFE_57). The value
-   *        is the command object for clients starting with that version.
+   * @return legacy singleton instance. Instance is not immutable.
    */
-  public static void registerCommand(int messageType,
+  @Deprecated
+  public static CommandInitializer getDefaultInstance() {
+    return instance;
+  }
+
+  final Map<KnownVersion, Map<Integer, Command>> 
unmodifiableRegisteredCommands;
+  final LinkedHashMap<KnownVersion, ConcurrentMap<Integer, Command>> 
modifiableRegisteredCommands;

Review comment:
       You can think of the unmodifiable version of the map as just a map of 
unmodifiable wrappers. It doesn't contain any data itself. I am not committed 
to it though if you don't like it.




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

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to