You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@bookkeeper.apache.org by GitBox <gi...@apache.org> on 2018/02/03 17:32:38 UTC

[GitHub] sijie closed pull request #1116: Cleanup registration client interface

sijie closed pull request #1116: Cleanup registration client interface
URL: https://github.com/apache/bookkeeper/pull/1116
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/bookkeeper-server/src/main/java/org/apache/bookkeeper/discover/RegistrationClient.java b/bookkeeper-server/src/main/java/org/apache/bookkeeper/discover/RegistrationClient.java
index b22311f86..7b18325b1 100644
--- a/bookkeeper-server/src/main/java/org/apache/bookkeeper/discover/RegistrationClient.java
+++ b/bookkeeper-server/src/main/java/org/apache/bookkeeper/discover/RegistrationClient.java
@@ -30,7 +30,6 @@
 import org.apache.bookkeeper.net.BookieSocketAddress;
 import org.apache.bookkeeper.stats.StatsLogger;
 import org.apache.bookkeeper.versioning.Versioned;
-import org.apache.zookeeper.ZooKeeper;
 
 /**
  * A registration client, which the bookkeeper client will use to interact with registration service.
@@ -55,13 +54,13 @@
      *
      * @param conf client configuration
      * @param statsLogger stats logger
-     * @param zkOptional a supplier to supply zookeeper client.
+     * @param optionalCtx optional context is passed for initialization.
      * @return
      */
     RegistrationClient initialize(ClientConfiguration conf,
                                   ScheduledExecutorService scheduler,
                                   StatsLogger statsLogger,
-                                  Optional<ZooKeeper> zkOptional)
+                                  Optional<Object> optionalCtx)
         throws BKException;
 
     @Override
diff --git a/bookkeeper-server/src/main/java/org/apache/bookkeeper/discover/ZKRegistrationClient.java b/bookkeeper-server/src/main/java/org/apache/bookkeeper/discover/ZKRegistrationClient.java
index 36c38ddc5..6633d9c6b 100644
--- a/bookkeeper-server/src/main/java/org/apache/bookkeeper/discover/ZKRegistrationClient.java
+++ b/bookkeeper-server/src/main/java/org/apache/bookkeeper/discover/ZKRegistrationClient.java
@@ -197,7 +197,7 @@ public synchronized void close() {
     public RegistrationClient initialize(ClientConfiguration conf,
                                          ScheduledExecutorService scheduler,
                                          StatsLogger statsLogger,
-                                         Optional<ZooKeeper> zkOptional)
+                                         Optional<Object> zkOptional)
             throws BKException {
         this.conf = conf;
         this.scheduler = scheduler;
@@ -208,8 +208,10 @@ public RegistrationClient initialize(ClientConfiguration conf,
         this.acls = ZkUtils.getACLs(conf);
 
         // construct the zookeeper
-        if (zkOptional.isPresent()) {
-            this.zk = zkOptional.get();
+        if (zkOptional.isPresent()
+            && zkOptional.get() instanceof ZooKeeper) {
+            // if an external zookeeper is added, use the zookeeper instance
+            this.zk = (ZooKeeper) (zkOptional.get());
             this.ownZKHandle = false;
         } else {
             try {


 

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services