You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@geode.apache.org by GitBox <gi...@apache.org> on 2022/05/25 21:10:12 UTC

[GitHub] [geode] dschneider-pivotal commented on a diff in pull request #7688: GEODE-10326: Convert MessageType to enum.

dschneider-pivotal commented on code in PR #7688:
URL: https://github.com/apache/geode/pull/7688#discussion_r882117180


##########
geode-core/src/main/java/org/apache/geode/internal/cache/tier/MessageType.java:
##########
@@ -12,604 +12,430 @@
  * or implied. See the License for the specific language governing permissions and limitations under
  * the License.
  */
+
 package org.apache.geode.internal.cache.tier;
 
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import org.apache.geode.annotations.Immutable;
+
 /**
  * Pre-defined message types supported by the system
  *
  * @since GemFire 2.0.2
  */
-public class MessageType {
+public enum MessageType {
   /** An invalid message, typically due to problems receiving a complete message */
-  public static final int INVALID = -1;
+  INVALID(-1),
 
   /** A request for a value from a region */
-  public static final int REQUEST = 0;
+  REQUEST(0),
 
   /** The value from a region */
-  public static final int RESPONSE = 1;
+  RESPONSE(1),
 
-  /** An acception occurred while accessing a region */
-  public static final int EXCEPTION = 2;
+  /** An exception occurred while accessing a region */
+  EXCEPTION(2),
 
   /** The get request data was bad (null key, for example) */
-  public static final int REQUESTDATAERROR = 3;
+  REQUESTDATAERROR(3),
 
-  // public static final int DATANOTFOUNDERROR = 4;
+  // DATANOTFOUNDERROR(4),
 
   /** A ping request */
-  public static final int PING = 5;
+  PING(5),
 
   /** A ping reply */
-  public static final int REPLY = 6;
+  REPLY(6),
 
   /**
    * Put data into the cache
    *
    * @since GemFire 3.5
    */
-  public static final int PUT = 7;
+  PUT(7),
 
   /**
    * The put request data was bad (null key or value, for example)
    *
    * @since GemFire 3.5
    */
-  public static final int PUT_DATA_ERROR = 8;
+  PUT_DATA_ERROR(8),
 
   /**
    * Destroy an entry from the cache
    *
    * @since GemFire 3.5
    */
-  public static final int DESTROY = 9;
+  DESTROY(9),
 
   /**
    * The destroy request data was bad (null key, for example)
    *
    * @since GemFire 3.5
    */
-  public static final int DESTROY_DATA_ERROR = 10;
+  DESTROY_DATA_ERROR(10),
 
   /**
    * Destroy a region from the cache
    *
    * @since GemFire 3.5
    */
-  public static final int DESTROY_REGION = 11;
+  DESTROY_REGION(11),
 
   /**
    * The destroy region request data was bad (null region name, for example)
    *
    * @since GemFire 3.5
    */
-  public static final int DESTROY_REGION_DATA_ERROR = 12;
+  DESTROY_REGION_DATA_ERROR(12),
 
   /**
    * A client wished to be notified of updates
    *
    * @since GemFire 3.5
    */
-  public static final int CLIENT_NOTIFICATION = 13;
+  CLIENT_NOTIFICATION(13),
 
   /**
    * Information about a client receiving updates has changed
    *
    * @since GemFire 3.5
    */
-  public static final int UPDATE_CLIENT_NOTIFICATION = 14;
+  UPDATE_CLIENT_NOTIFICATION(14),
 
   /**
    * The receiver (which is an edge client in this case) should locally invalidate a piece of data
    *
    * @since GemFire 3.5
    */
-  public static final int LOCAL_INVALIDATE = 15;
+  LOCAL_INVALIDATE(15),
 
   /**
    * The receiver (which is an edge client in this case) should locally destroy a piece of data
    *
    * @since GemFire 3.5
    */
-  public static final int LOCAL_DESTROY = 16;
+  LOCAL_DESTROY(16),
 
   /**
    * The receiver (which is an edge client in this case) should locally destroy a region
    *
    * @since GemFire 3.5
    */
-  public static final int LOCAL_DESTROY_REGION = 17;
+  LOCAL_DESTROY_REGION(17),
 
   /**
    * A message to close the client connection
    *
    * @since GemFire 3.5
    */
-  public static final int CLOSE_CONNECTION = 18;
+  CLOSE_CONNECTION(18),
 
   /**
    * A message to process a batch of messages
    *
    * @since GemFire 4.1.1
    */
-  public static final int PROCESS_BATCH = 19;
+  PROCESS_BATCH(19),
 
   /**
    * A message to register interest in a specific key
    *
    * @since GemFire 4.1.2
    */
-  public static final int REGISTER_INTEREST = 20;
+  REGISTER_INTEREST(20),
 
   /**
    * The register interest request data was bad (null region name, for example)
    *
    * @since GemFire 4.1.2
    */
-  public static final int REGISTER_INTEREST_DATA_ERROR = 21;
+  REGISTER_INTEREST_DATA_ERROR(21),
 
   /**
    * A message to unregister interest in a specific key
    *
    * @since GemFire 4.1.2
    */
-  public static final int UNREGISTER_INTEREST = 22;
+  UNREGISTER_INTEREST(22),
 
   /**
    * The unregister interest request data was bad (null region name, for example)
    *
    * @since GemFire 4.1.2
    */
-  public static final int UNREGISTER_INTEREST_DATA_ERROR = 23;
+  UNREGISTER_INTEREST_DATA_ERROR(23),
 
   /**
    * A message to register interest in a specific list of keys
    *
    * @since GemFire 4.1.2
    */
-  public static final int REGISTER_INTEREST_LIST = 24;
+  REGISTER_INTEREST_LIST(24),
 
   /**
    * A message to unregister interest in a specific list of keys
    *
    * @since GemFire 4.1.2
    */
-  public static final int UNREGISTER_INTEREST_LIST = 25;
+  UNREGISTER_INTEREST_LIST(25),
 
   /**
    * An unknown message type. This is being used for responses.
    *
    * @since GemFire 4.1.2
    */
-  public static final int UNKNOWN_MESSAGE_TYPE_ERROR = 26;
+  UNKNOWN_MESSAGE_TYPE_ERROR(26),
 
   /**
    * The receiver (which is an edge client in this case) should locally create a piece of data
    *
    * @since GemFire 4.1.2
    */
-  public static final int LOCAL_CREATE = 27;
+  LOCAL_CREATE(27),
 
   /**
    * The receiver (which is an edge client in this case) should locally update a piece of data
    *
    * @since GemFire 4.1.2
    */
-  public static final int LOCAL_UPDATE = 28;
+  LOCAL_UPDATE(28),
 
-  public static final int CREATE_REGION = 29;
-  public static final int CREATE_REGION_DATA_ERROR = 30;
+  CREATE_REGION(29),
+  CREATE_REGION_DATA_ERROR(30),
 
   /**
    * A message to make primary server
    *
    * @since GemFire 5.1
    */
-  public static final int MAKE_PRIMARY = 31;
+  MAKE_PRIMARY(31),
 
   /**
    * Response message type from primary server
    *
    * @since GemFire 5.1
    */
-  public static final int RESPONSE_FROM_PRIMARY = 32;
+  RESPONSE_FROM_PRIMARY(32),
 
   /**
    * Response message type from secondary server
    *
    * @since GemFire 5.1
    */
-  public static final int RESPONSE_FROM_SECONDARY = 33;
+  RESPONSE_FROM_SECONDARY(33),
 
   /**
    * A query request message
    *
-   * <p>
-   * author gregp
-   *
    * @since GemFire 4.1.1
    */
-  public static final int QUERY = 34;
+  QUERY(34),
 
-  public static final int QUERY_DATA_ERROR = 35;
+  QUERY_DATA_ERROR(35),
 
-  public static final int CLEAR_REGION = 36;
+  CLEAR_REGION(36),
 
-  public static final int CLEAR_REGION_DATA_ERROR = 37;
+  CLEAR_REGION_DATA_ERROR(37),
 
-  public static final int CONTAINS_KEY = 38;
+  CONTAINS_KEY(38),
 
-  public static final int CONTAINS_KEY_DATA_ERROR = 39;
+  CONTAINS_KEY_DATA_ERROR(39),
 
-  public static final int KEY_SET = 40;
+  KEY_SET(40),
 
-  public static final int KEY_SET_DATA_ERROR = 41;
+  KEY_SET_DATA_ERROR(41),
 
-  public static final int EXECUTECQ_MSG_TYPE = 42;
+  EXECUTECQ_MSG_TYPE(42),

Review Comment:
   All of these CQ ones that end with _MSG_TYPE dropped "_MSG_TYPE" from the String that was returned from getString. Since you now just use the Enum's string, I think you should rename all these CQ ones to not have _MSG_TYPE in their name. That way any log messages will be the same as before.



-- 
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: notifications-unsubscribe@geode.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org