lhotari commented on code in PR #23152:
URL: https://github.com/apache/pulsar/pull/23152#discussion_r1718581639
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/extensions/channel/ServiceUnitStateChannelImpl.java:
##########
@@ -325,6 +325,16 @@ public synchronized void start() throws
PulsarServerException {
ServiceUnitStateCompactionStrategy.class.getName()))
.create();
tableview.listen((key, value) -> handle(key, value));
+ tableview.forEach((serviceUnit, data) -> {
+ if (debug) {
+ log.info("Loaded the service unit state data. serviceUnit:
{}, data: {}", serviceUnit, data);
+ }
+ ServiceUnitState state = state(data);
+ if (state.equals(Owned) && isTargetBroker(data.dstBroker())) {
+ pulsar.getNamespaceService()
+
.onNamespaceBundleOwned(LoadManagerShared.getNamespaceBundle(pulsar,
serviceUnit));
+ }
+ });
Review Comment:
@Demogorgon314 @heesung-sn In that case, I'd recommend refactoring the code
so that `handle` is renamed to `handleEvent` and the function passed to the
`.forEach` is moved to a new method `handleExisting` (or whatever naming
describes this better).
Once the PIP for TableView improvements is processed, it can be migrated to
use that. Makes sense?
--
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]