dajac commented on code in PR #21450:
URL: https://github.com/apache/kafka/pull/21450#discussion_r2792915940
##########
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/GroupMetadataManager.java:
##########
@@ -7768,35 +7749,31 @@ private CoordinatorResult<HeartbeatResponseData,
CoordinatorRecord> classicGroup
) {
validateClassicGroupHeartbeat(group, request.memberId(),
request.groupInstanceId(), request.generationId());
- switch (group.currentState()) {
- case EMPTY:
- return new CoordinatorResult<>(
+ return switch (group.currentState()) {
+ case EMPTY -> new CoordinatorResult<>(
List.of(),
new
HeartbeatResponseData().setErrorCode(Errors.UNKNOWN_MEMBER_ID.code())
- );
-
- case PREPARING_REBALANCE:
+ );
+ case PREPARING_REBALANCE -> {
rescheduleClassicGroupMemberHeartbeat(group,
group.member(request.memberId()));
- return new CoordinatorResult<>(
- List.of(),
- new
HeartbeatResponseData().setErrorCode(Errors.REBALANCE_IN_PROGRESS.code())
+ yield new CoordinatorResult<>(
+ List.of(),
+ new
HeartbeatResponseData().setErrorCode(Errors.REBALANCE_IN_PROGRESS.code())
Review Comment:
nit: indentation seems off.
##########
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/GroupMetadataManager.java:
##########
@@ -7768,35 +7749,31 @@ private CoordinatorResult<HeartbeatResponseData,
CoordinatorRecord> classicGroup
) {
validateClassicGroupHeartbeat(group, request.memberId(),
request.groupInstanceId(), request.generationId());
- switch (group.currentState()) {
- case EMPTY:
- return new CoordinatorResult<>(
+ return switch (group.currentState()) {
+ case EMPTY -> new CoordinatorResult<>(
List.of(),
new
HeartbeatResponseData().setErrorCode(Errors.UNKNOWN_MEMBER_ID.code())
- );
-
- case PREPARING_REBALANCE:
+ );
+ case PREPARING_REBALANCE -> {
rescheduleClassicGroupMemberHeartbeat(group,
group.member(request.memberId()));
- return new CoordinatorResult<>(
- List.of(),
- new
HeartbeatResponseData().setErrorCode(Errors.REBALANCE_IN_PROGRESS.code())
+ yield new CoordinatorResult<>(
+ List.of(),
+ new
HeartbeatResponseData().setErrorCode(Errors.REBALANCE_IN_PROGRESS.code())
);
-
- case COMPLETING_REBALANCE:
- case STABLE:
+ }
+ case COMPLETING_REBALANCE, STABLE -> {
// Consumers may start sending heartbeats after join-group
response, while the group
// is in CompletingRebalance state. In this case, we should
treat them as
// normal heartbeat requests and reset the timer
rescheduleClassicGroupMemberHeartbeat(group,
group.member(request.memberId()));
- return new CoordinatorResult<>(
- List.of(),
- new HeartbeatResponseData()
+ yield new CoordinatorResult<>(
+ List.of(),
+ new HeartbeatResponseData()
Review Comment:
ditto.
--
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]