ivankelly commented on a change in pull request #1192: BP-29 (task 3): use 
metadata service uri for constructing registration client
URL: https://github.com/apache/bookkeeper/pull/1192#discussion_r170568755
 
 

 ##########
 File path: 
bookkeeper-server/src/main/java/org/apache/bookkeeper/client/BookKeeper.java
 ##########
 @@ -441,21 +447,22 @@ public BookKeeper(ClientConfiguration conf, ZooKeeper 
zk, EventLoopGroup eventLo
         this.disableEnsembleChangeFeature =
             
this.featureProvider.getFeature(conf.getDisableEnsembleChangeFeatureName());
 
-        // initialize registration client
+        // initialize metadata driver
         try {
-            Class<? extends RegistrationClient> regClientCls = 
conf.getRegistrationClientClass();
-            this.regClient = ReflectionUtils.newInstance(regClientCls);
-            this.regClient.initialize(
+            this.metadataDriver = MetadataDrivers.getClientDriver(
+                URI.create(conf.getMetadataServiceUri()));
+            this.metadataDriver.initialize(
                 conf,
                 scheduler,
                 statsLogger,
                 java.util.Optional.ofNullable(zkc));
+            this.regClient = this.metadataDriver.getRegistrationClient();
         } catch (ConfigurationException ce) {
-            LOG.error("Failed to initialize registration client", ce);
-            throw new IOException("Failed to initialize registration client", 
ce);
-        } catch (BKException be) {
-            LOG.error("Failed to initialize registration client", be);
-            throw new IOException("Failed to initialize registration client", 
be);
+            LOG.error("Failed to initialize metadata client driver", ce);
 
 Review comment:
   since handling is identical, you can just use ```catch 
(ConfigurationException | MetadataException e)```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to