merlimat commented on a change in pull request #10391:
URL: https://github.com/apache/pulsar/pull/10391#discussion_r623280495



##########
File path: 
pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/NoopLoadManager.java
##########
@@ -63,33 +53,17 @@ public void start() throws PulsarServerException {
                 + pulsar.getConfiguration().getWebServicePort().get();
         localResourceUnit = new SimpleResourceUnit(String.format("http://%s";, 
lookupServiceAddress),
                 new PulsarResourceDescription());
-        zkClient = pulsar.getZkClient();
 
-        localData = new LocalBrokerData(pulsar.getSafeWebServiceAddress(), 
pulsar.getWebServiceAddressTls(),
+        LocalBrokerData localData = new 
LocalBrokerData(pulsar.getSafeWebServiceAddress(),
+                pulsar.getWebServiceAddressTls(),
                 pulsar.getSafeBrokerServiceUrl(), 
pulsar.getBrokerServiceUrlTls());
         localData.setProtocols(pulsar.getProtocolDataToAdvertise());
-        String brokerZnodePath = LoadManager.LOADBALANCE_BROKERS_ROOT + "/" + 
lookupServiceAddress;
+        String brokerReportPath = LoadManager.LOADBALANCE_BROKERS_ROOT + "/" + 
lookupServiceAddress;
 
         try {
-            // When running in standalone, this error can happen when killing 
the "standalone" process
-            // ungracefully since the ZK session will not be closed and it 
will take some time for ZK server
-            // to prune the expired sessions after startup.
-            // Since there's a single broker instance running, it's safe, in 
this mode, to remove the old lock
-
-            // Delete and recreate z-node
-            try {
-                if (zkClient.exists(brokerZnodePath, null) != null) {
-                    zkClient.delete(brokerZnodePath, -1);
-                }
-            } catch (NoNodeException nne) {
-                // Ignore if z-node was just expired
-            }
-
-            ZkUtils.createFullPathOptimistic(zkClient, brokerZnodePath, 
localData.getJsonBytes(),
-                    ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.EPHEMERAL);
-
-        } catch (Exception e) {
-            throw new PulsarServerException(e);
+            lockManager.acquireLock(brokerReportPath, localData).join();
+        } catch (CompletionException ce) {

Review comment:
       yes, the `join()` is blocking and throws `CompletionException`
   




-- 
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.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to