cmccabe commented on a change in pull request #10066:
URL: https://github.com/apache/kafka/pull/10066#discussion_r578701957
##########
File path: clients/src/main/java/org/apache/kafka/common/protocol/ApiKeys.java
##########
@@ -246,10 +250,15 @@ public void visit(Type field) {
return hasBuffer.get();
}
- public static List<ApiKeys> brokerApis() {
- return Arrays.stream(values())
- .filter(api -> !api.isControllerOnlyApi)
+ public static EnumSet<ApiKeys> zkBrokerApis() {
+ return apisForListener(ApiMessageType.ListenerType.ZK_BROKER);
+ }
+
+ public static EnumSet<ApiKeys> apisForListener(ApiMessageType.ListenerType
listener) {
Review comment:
given that these `EnumSets` are used so much throughout the code, we
should just calculate them once and reuse them, rather than recalculating each
time. There are only 3 listener types so it could just be in a static map or
something.
----------------------------------------------------------------
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]