BewareMyPower commented on code in PR #19102:
URL: https://github.com/apache/pulsar/pull/19102#discussion_r1061313426
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/extensions/channel/ServiceUnitStateChannel.java:
##########
@@ -51,7 +51,7 @@ public interface ServiceUnitStateChannel extends Closeable {
*
* ServiceUnitStateChannel elects the separate leader as the owner broker
of the system topic in this channel.
*/
- CompletableFuture<Optional<String>> getChannelOwnerAsync();
+ CompletableFuture<String> getChannelOwnerAsync();
Review Comment:
We should keep using the `Optional` here. I see the comments
[here](https://github.com/apache/pulsar/pull/19102/files#r1059201582). But the
root cause is that you should not throw an unchecked exception when leader is
empty. It's an expected error and we should pass the result (leader is empty,
i.e. an empty `Optional` is returned) to the caller side.
--
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]