tjake commented on code in PR #1954:
URL: https://github.com/apache/cassandra/pull/1954#discussion_r1039025145
##########
src/java/org/apache/cassandra/net/MessagingService.java:
##########
@@ -212,6 +215,23 @@ public class MessagingService extends
MessagingServiceMBeanImpl
public static final int current_version = VERSION_40;
static AcceptVersions accept_messaging = new
AcceptVersions(minimum_version, current_version);
static AcceptVersions accept_streaming = new
AcceptVersions(current_version, current_version);
+ static Map<Integer, Integer> versionIndexMap =
Arrays.stream(Version.values()).collect(Collectors.toMap(v -> v.value, v ->
v.ordinal()));
+
+ /**
+ * This is an optimisation to speed up the translation of the serialization
+ * version to the {@link Version} enum.
+ *
+ * @param version the serialization version
+ * @return a {@link Version}
+ */
+ public static int getVersionIndex(int version)
+ {
+ if (versionIndexMap.containsKey(version))
+ return versionIndexMap.get(version);
+ throw new IllegalStateException("Unkown serialization version: " +
version);
+ }
+
+ public final static boolean NON_GRACEFUL_SHUTDOWN =
Boolean.getBoolean("cassandra.test.messagingService.nonGracefulShutdown");
Review Comment:
oops
--
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]