Github user joshelser commented on a diff in the pull request: https://github.com/apache/phoenix/pull/234#discussion_r106558662 --- Diff: phoenix-queryserver/src/main/java/org/apache/phoenix/queryserver/server/QueryServer.java --- @@ -128,10 +133,40 @@ public QueryServer() { /** Constructor for use as {@link java.lang.Runnable}. */ public QueryServer(String[] argv, Configuration conf) { + this(argv,conf,null); + } + + /** Constructor for use as {@link java.lang.Runnable}. */ + public QueryServer(String[] argv, Configuration conf,String zookeeperConnectString) { this.argv = argv; setConf(conf); + this.zookeeperConnectString = zookeeperConnectString; + + } + + public void registerToServiceProvider(Configuration conf ) { + String basePath = conf.get(QueryServices.PHOENIX_QUERYSERVER_BASE_PATH); + String serviceName = conf.get(QueryServices.PHOENIX_QUERYSERVER_SERVICENAME); + if (zookeeperConnectString == null) { + String zookeeperQuorum = conf.get(QueryServices.ZOOKEEPER_QUORUM_ATTRIB); + String zookeeperPort = conf.get(QueryServices.ZOOKEEPER_PORT_ATTRIB); + zookeeperConnectString = String.format("%s:%s",zookeeperQuorum,zookeeperPort); + } + try { + registry = new ZookeeperRegistry(); + int avaticaServerPort = getPort(); + registry.registerServer(10, basePath, serviceName, + avaticaServerPort, zookeeperConnectString); + registry.start(); + } catch(Exception ex) { + LOG.error("Unable to connect to zookeeper instance ",ex); + System.exit(-1); + } } + public void closeRegistration() throws IOException { --- End diff -- Who should be calling this? Should there be a shutdown hook in place to invoke this?
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---