Source:
public RealmAwareZkClient getRealmAwareZkClient() { if (_zkClient == null) { synchronized (this) { if (_zkClient == null) { if (_isMultiZkEnabled || Boolean .parseBoolean(System.getProperty(SystemPropertyKeys.MULTI_ZK_ENABLED))) { try { if (_zkClientForListener == null) { _zkClientForListener = DedicatedZkClientFactory.getInstance() .buildZkClient(new HelixZkClient.ZkConnectionConfig(_zkAddr), new HelixZkClient.ZkClientConfig() .setZkSerializer(new ZNRecordSerializer())); } _zkClientForListener.unsubscribeAll(); _zkClientForListener.subscribeRoutingDataChanges(this, this); LOG.info("ServerContext: subscribed to routing data in routing ZK at {}!", _zkAddr); RealmAwareZkClient.RealmAwareZkConnectionConfig.Builder connectionConfigBuilder = new RealmAwareZkClient.RealmAwareZkConnectionConfig.Builder(); if (_msdsEndpoint != null && !_msdsEndpoint.isEmpty()) { connectionConfigBuilder.setMsdsEndpoint(_msdsEndpoint); } _zkClient = new FederatedZkClient(connectionConfigBuilder.build(), new RealmAwareZkClient.RealmAwareZkClientConfig() .setZkSerializer(new ZNRecordSerializer())); LOG.info("ServerContext: FederatedZkClient created successfully!"); } catch (IOException | InvalidRoutingDataException | IllegalStateException e) { throw new HelixException("Failed to create FederatedZkClient!", e); } } else { HelixZkClient.ZkClientConfig clientConfig = new HelixZkClient.ZkClientConfig(); clientConfig.setZkSerializer(new ZNRecordSerializer()); _zkClient = SharedZkClientFactory.getInstance() .buildZkClient(new HelixZkClient.ZkConnectionConfig(_zkAddr), clientConfig); } } } } return _zkClient; }

Target:
public RealmAwareZkClient getRealmAwareZkClient() { if (_zkClient == null) { synchronized (this) { if (_zkClient == null) { if (_isMultiZkEnabled || Boolean .parseBoolean(System.getProperty(SystemPropertyKeys.MULTI_ZK_ENABLED))) { try { if (_zkClientForListener == null) { _zkClientForListener = DedicatedZkClientFactory.getInstance() .buildZkClient(new HelixZkClient.ZkConnectionConfig(_zkAddr), new HelixZkClient.ZkClientConfig() .setZkSerializer(new ZNRecordSerializer())); } _zkClientForListener.unsubscribeAll(); _zkClientForListener.subscribeRoutingDataChanges(this, this); LOG.info("ServerContext: subscribed to routing data in routing ZK at {}!", _zkAddr); RealmAwareZkClient.RealmAwareZkConnectionConfig.Builder connectionConfigBuilder = new RealmAwareZkClient.RealmAwareZkConnectionConfig.Builder(); if (_msdsEndpoint != null && !_msdsEndpoint.isEmpty()) { connectionConfigBuilder.setMsdsEndpoint(_msdsEndpoint); } _zkClient = new FederatedZkClient(connectionConfigBuilder.build(), new RealmAwareZkClient.RealmAwareZkClientConfig() .setZkSerializer(new ZNRecordSerializer())); LOG.info("ServerContext: FederatedZkClient created successfully!"); } catch (IOException | InvalidRoutingDataException | IllegalStateException e) { LOG.error("Failed to create FederatedZkClient!", e); throw new HelixException("Failed to create FederatedZkClient!", e); } } else { HelixZkClient.ZkClientConfig clientConfig = new HelixZkClient.ZkClientConfig(); clientConfig.setZkSerializer(new ZNRecordSerializer()); _zkClient = SharedZkClientFactory.getInstance() .buildZkClient(new HelixZkClient.ZkConnectionConfig(_zkAddr), clientConfig); } } } } return _zkClient; }