Returns the configured ZooKeeper quorum (and removes whitespace, because ZooKeeper does not
tolerate it).
430741
public static String getZooKeeperEnsemble(Configuration flinkConf)
			throws IllegalConfigurationException {

		String zkQuorum = flinkConf.getValue(HighAvailabilityOptions.HA_ZOOKEEPER_QUORUM);

		if (zkQuorum == null || StringUtils.isBlank(zkQuorum)) {
			throw new IllegalConfigurationException("No ZooKeeper quorum specified in config.");
		}

		// Remove all whitespace
		zkQuorum = zkQuorum.replaceAll("\\s+", "");

		return zkQuorum;
	}
136916
private WhiteSpace getDatatypeWhiteSpace() {
		Grammar currGr = this.getCurrentGrammar();
		if (currGr.isSchemaInformed() && currGr.getNumberOfEvents() > 0) {
			Production prod = currGr.getProduction(0);
			if (prod.getEvent().getEventType() == EventType.CHARACTERS) {
				Characters ch = (Characters) prod.getEvent();
				return ch.getDatatype().getWhiteSpace();
			}
		}

		return null;
	}
1140278
public SpacePermissionManager getSpacePermissionManager() {
        if (spacePermissionManager != null) {
            return spacePermissionManager;
        }
        spacePermissionManager = (SpacePermissionManager) ContainerManager.getComponent("spacePermissionManager");
        return spacePermissionManager;
    }
587043
public static CuratorFramework startCuratorFramework(Configuration configuration) {
		Preconditions.checkNotNull(configuration, "configuration");
		String zkQuorum = configuration.getValue(HighAvailabilityOptions.HA_ZOOKEEPER_QUORUM);

		if (zkQuorum == null || StringUtils.isBlank(zkQuorum)) {
			throw new RuntimeException("No valid ZooKeeper quorum has been specified. " +
					"You can specify the quorum via the configuration key '" +
					HighAvailabilityOptions.HA_ZOOKEEPER_QUORUM.key() + "'.");
		}

		int sessionTimeout = configuration.getInteger(HighAvailabilityOptions.ZOOKEEPER_SESSION_TIMEOUT);

		int connectionTimeout = configuration.getInteger(HighAvailabilityOptions.ZOOKEEPER_CONNECTION_TIMEOUT);

		int retryWait = configuration.getInteger(HighAvailabilityOptions.ZOOKEEPER_RETRY_WAIT);

		int maxRetryAttempts = configuration.getInteger(HighAvailabilityOptions.ZOOKEEPER_MAX_RETRY_ATTEMPTS);

		String root = configuration.getValue(HighAvailabilityOptions.HA_ZOOKEEPER_ROOT);

		String namespace = configuration.getValue(HighAvailabilityOptions.HA_CLUSTER_ID);

		boolean disableSaslClient = configuration.getBoolean(SecurityOptions.ZOOKEEPER_SASL_DISABLE);

		ACLProvider aclProvider;

		ZkClientACLMode aclMode = ZkClientACLMode.fromConfig(configuration);

		if (disableSaslClient && aclMode == ZkClientACLMode.CREATOR) {
			String errorMessage = "Cannot set ACL role to " + aclMode + "  since SASL authentication is " +
					"disabled through the " + SecurityOptions.ZOOKEEPER_SASL_DISABLE.key() + " property";
			LOG.warn(errorMessage);
			throw new IllegalConfigurationException(errorMessage);
		}

		if (aclMode == ZkClientACLMode.CREATOR) {
			LOG.info("Enforcing creator for ZK connections");
			aclProvider = new SecureAclProvider();
		} else {
			LOG.info("Enforcing default ACL for ZK connections");
			aclProvider = new DefaultACLProvider();
		}

		String rootWithNamespace = generateZookeeperPath(root, namespace);

		LOG.info("Using '{}' as Zookeeper namespace.", rootWithNamespace);

		CuratorFramework cf = CuratorFrameworkFactory.builder()
				.connectString(zkQuorum)
				.sessionTimeoutMs(sessionTimeout)
				.connectionTimeoutMs(connectionTimeout)
				.retryPolicy(new ExponentialBackoffRetry(retryWait, maxRetryAttempts))
				// Curator prepends a '/' manually and throws an Exception if the
				// namespace starts with a '/'.
				.namespace(rootWithNamespace.startsWith("/") ? rootWithNamespace.substring(1) : rootWithNamespace)
				.aclProvider(aclProvider)
				.build();

		cf.start();

		return cf;
	}
1290320
static void createIfNotThere(ZooKeeper zookeeper, String znode) throws KeeperException, InterruptedException {
        try {
            create(zookeeper, znode);
        } catch (KeeperException e) {
            if (e.code() != KeeperException.Code.NODEEXISTS) {
                // Rethrow all exceptions, except "node exists",
                // because if the node exists, this method reached its goal.
                throw e;
            }
        }
    }
918061
function ZooKeeperService(name, type, options) {
	this.name = name;
	this.type = type;
	this.options = options;

	this.closed = false;
	this.announcing = false;
	this.discovering = false;

	// this is the base path we will use to announce this service
	this.baseAnnouncePath = ['/mage', this.name, this.type].join('/');

	// those are the nodes we know on the given path
	this.nodes = [];

	// node data is stored apart
	this.services = {};

	this.connectTimer = null;
	this.clearCredentialsTimer = null;

	// Initial setup
	this.reset();
}
543823
def delete(self, robj, rw=None, r=None, w=None, dw=None, pr=None, pw=None,
               timeout=None):
        
        # We could detect quorum_controls here but HTTP ignores
        # unknown flags/params.
        params = {'rw': rw, 'r': r, 'w': w, 'dw': dw, 'pr': pr, 'pw': pw,
                  'timeout': timeout}
        headers = {}

        bucket_type = self._get_bucket_type(robj.bucket.bucket_type)

        url = self.object_path(robj.bucket.name, robj.key,
                               bucket_type=bucket_type, **params)
        use_vclocks = (self.tombstone_vclocks() and hasattr(robj, 'vclock') and
                       robj.vclock is not None)
        if use_vclocks:
            headers['X-Riak-Vclock'] = robj.vclock.encode('base64')
        response = self._request('DELETE', url, headers)
        self.check_http_code(response[0], [204, 404])
        return self
849135
public static CuratorFramework newRootFluoCurator(FluoConfiguration config) {
    return newCurator(ZookeeperUtil.parseServers(config.getInstanceZookeepers()),
        config.getZookeeperTimeout(), config.getZookeeperSecret());
  }
538892
def fetch(self, zookeeper_path, settings=None):
        
        return self._partition_operation_sql('FETCH', settings=settings, from_part=zookeeper_path)
639263
public static MigratePartitionLeaderInfo getMigratePartitionLeaderInfo(ZooKeeper zk) {
        try {
            byte[] data = zk.getData(migrate_partition_leader_info, null, null);
            if (data != null) {
                MigratePartitionLeaderInfo info = new MigratePartitionLeaderInfo(data);
                return info;
            }
        } catch (KeeperException | InterruptedException | JSONException e) {
        }
        return null;
    }
878177
def get(self, robj, r=None, pr=None, timeout=None, basic_quorum=None,
            notfound_ok=None, head_only=False):
        
        # We could detect quorum_controls here but HTTP ignores
        # unknown flags/params.
        params = {'r': r, 'pr': pr, 'timeout': timeout,
                  'basic_quorum': basic_quorum,
                  'notfound_ok': notfound_ok}

        bucket_type = self._get_bucket_type(robj.bucket.bucket_type)

        url = self.object_path(robj.bucket.name, robj.key,
                               bucket_type=bucket_type, **params)
        response = self._request('GET', url)
        return self._parse_body(robj, response, [200, 300, 404])
757999
def specialspaceless(parser, token):
    
    nodelist = parser.parse(('endspecialspaceless',))
    parser.delete_first_token()

    return SpecialSpacelessNode(nodelist)
419609
private void readZookeeperConfig() {

    try (CuratorFramework curator = CuratorUtil.newAppCurator(config)) {
      curator.start();

      accumuloInstance =
          new String(curator.getData().forPath(ZookeeperPath.CONFIG_ACCUMULO_INSTANCE_NAME),
              StandardCharsets.UTF_8);
      accumuloInstanceID =
          new String(curator.getData().forPath(ZookeeperPath.CONFIG_ACCUMULO_INSTANCE_ID),
              StandardCharsets.UTF_8);
      fluoApplicationID =
          new String(curator.getData().forPath(ZookeeperPath.CONFIG_FLUO_APPLICATION_ID),
              StandardCharsets.UTF_8);

      table = new String(curator.getData().forPath(ZookeeperPath.CONFIG_ACCUMULO_TABLE),
          StandardCharsets.UTF_8);

      observers = ObserverUtil.load(curator);

      config = FluoAdminImpl.mergeZookeeperConfig(config);

      // make sure not to include config passed to env, only want config from zookeeper
      appConfig = config.getAppConfiguration();
    } catch (Exception e) {
      throw new IllegalStateException(e);
    }
  }
402038
def disconnect(self):
        
        logger.info("Disconnecting from Zookeeper.")
        self.client.stop()
        self.client.close()
357584
private void checkZkConfiguration() {
    Preconditions.checkState(
        isSet(PropertyKey.ZOOKEEPER_ADDRESS) == getBoolean(PropertyKey.ZOOKEEPER_ENABLED),
        PreconditionMessage.INCONSISTENT_ZK_CONFIGURATION.toString(),
        PropertyKey.Name.ZOOKEEPER_ADDRESS, PropertyKey.Name.ZOOKEEPER_ENABLED);
  }
1237855
protected boolean doConnectAndCreateZkPath() {
        if (RpcServerConf.ENABLE_ZK_REGISTRY) {
            String path = ZkPathUtil.buildPath(NaviCommonConstant.ZOOKEEPER_BASE_PATH,
                    RpcServerConf.ZK_REGISTRY_NAMESPACE);
            try {
                LOG.info("Connecting to zookeeper server - " + RpcServerConf.ZK_SERVER_LIST);
                zkClient = new SimpleZooKeeperClient(RpcServerConf.ZK_SERVER_LIST,
                        RpcServerConf.ZK_DIGEST_AUTH, new ServerServiceWatcher());
                LOG.info("Connect to zookeeper server successfully!");
                LOG.info("Trying create service registry path - " + path);
                zkClient.createNodeForRecursive(path, "".getBytes());
                LOG.info("Create service registry path successfully!");
            } catch (NodeExistsException e) {
                LOG.warn("Zookeeper path is already exists - " + path);
            } catch (Exception e) {
                LOG.error("Zookeeper client initialization failed, " + e.getMessage(), e);
                return false;
            }
        }
        return true;
    }
1050948
def cli(ctx, omit_empty_organisms=False):
    
    return ctx.gi.users.get_users(omit_empty_organisms=omit_empty_organisms)