sijie 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_r170903291
 
 

 ##########
 File path: 
bookkeeper-server/src/main/java/org/apache/bookkeeper/meta/MetadataDrivers.java
 ##########
 @@ -167,17 +167,28 @@ private static void loadInitialBookieDrivers() {
      */
     public static void registerClientDriver(String metadataBackendScheme,
                                             Class<? extends 
MetadataClientDriver> driver) {
+        registerClientDriver(metadataBackendScheme, driver, false);
+    }
+
+    @VisibleForTesting
+    public static void registerClientDriver(String metadataBackendScheme,
+                                            Class<? extends 
MetadataClientDriver> driver,
+                                            boolean allowOverride) {
         if (!initialized) {
             initialize();
         }
 
         String scheme = metadataBackendScheme.toLowerCase();
         MetadataClientDriverInfo oldDriverInfo = clientDrivers.get(scheme);
-        if (null != oldDriverInfo) {
+        if (null != oldDriverInfo && !allowOverride) {
             return;
         }
         MetadataClientDriverInfo newDriverInfo = new 
MetadataClientDriverInfo(driver);
-        oldDriverInfo = clientDrivers.putIfAbsent(scheme, newDriverInfo);
+        if (allowOverride) {
 
 Review comment:
   not sure this is better than current implementation. would prefer stick to 
current implementation unless there is a huge concern here.

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