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_r170773993
 
 

 ##########
 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:
   this changes the logging behavior though. the logging message is added after 
`put`, that is to handle concurrent puts. the change you are proposing here 
doesn't do that. 

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