dajac commented on code in PR #12240:
URL: https://github.com/apache/kafka/pull/12240#discussion_r890873379
##########
metadata/src/main/java/org/apache/kafka/metadata/BrokerRegistration.java:
##########
@@ -213,12 +230,30 @@ public String toString() {
bld.append("}");
bld.append(", rack=").append(rack);
bld.append(", fenced=").append(fenced);
+ bld.append(", inControlledShutdown=").append(inControlledShutdown);
bld.append(")");
return bld.toString();
}
- public BrokerRegistration cloneWithFencing(boolean fencing) {
- return new BrokerRegistration(id, epoch, incarnationId, listeners,
- supportedFeatures, rack, fencing);
+ public Optional<BrokerRegistration> maybeCloneWith(
+ Optional<Boolean> fencingChange,
+ Optional<Boolean> inControlledShutdownChange
+ ) {
+ boolean newFenced = fencingChange.orElse(fenced);
+ boolean newInControlledShutdownChange =
inControlledShutdownChange.orElse(inControlledShutdown);
+
+ if (newFenced == fenced && newInControlledShutdownChange ==
inControlledShutdown)
+ return Optional.empty();
Review Comment:
Yeah, you're right. I am not sure why I use this Optional here.
--
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]