dongnuo123 commented on code in PR #19042: URL: https://github.com/apache/kafka/pull/19042#discussion_r1972238070
########## group-coordinator/src/main/java/org/apache/kafka/coordinator/group/GroupCoordinatorService.java: ########## @@ -158,29 +160,28 @@ public Builder withGroupConfigManager(GroupConfigManager groupConfigManager) { return this; } + public Builder withAuthorizer(Optional<Authorizer> authorizer) { + this.authorizer = authorizer; + return this; + } + public GroupCoordinatorService build() { - if (config == null) - throw new IllegalArgumentException("Config must be set."); - if (writer == null) - throw new IllegalArgumentException("Writer must be set."); - if (loader == null) - throw new IllegalArgumentException("Loader must be set."); - if (time == null) - throw new IllegalArgumentException("Time must be set."); - if (timer == null) - throw new IllegalArgumentException("Timer must be set."); - if (coordinatorRuntimeMetrics == null) - throw new IllegalArgumentException("CoordinatorRuntimeMetrics must be set."); - if (groupCoordinatorMetrics == null) - throw new IllegalArgumentException("GroupCoordinatorMetrics must be set."); - if (groupConfigManager == null) - throw new IllegalArgumentException("GroupConfigManager must be set."); + requireNonNull(config, new IllegalArgumentException("Config must be set.")); + requireNonNull(writer, new IllegalArgumentException("Writer must be set.")); + requireNonNull(loader, new IllegalArgumentException("Loader must be set.")); + requireNonNull(time, new IllegalArgumentException("Time must be set.")); + requireNonNull(timer, new IllegalArgumentException("Timer must be set.")); + requireNonNull(coordinatorRuntimeMetrics, new IllegalArgumentException("CoordinatorRuntimeMetrics must be set.")); + requireNonNull(groupCoordinatorMetrics, new IllegalArgumentException("GroupCoordinatorMetrics must be set.")); + requireNonNull(groupConfigManager, new IllegalArgumentException("GroupConfigManager must be set.")); + requireNonNull(authorizer, new IllegalArgumentException("Authorizer must be set.")); Review Comment: Bring in `requrieNonNull` in advance because of checkstyle error -- 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: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org