Examples of HelixConfigScopeBuilder


Examples of org.apache.helix.model.builder.HelixConfigScopeBuilder

   */
  private void joinCluster() {
    boolean autoJoin = false;
    try {
      HelixConfigScope scope =
          new HelixConfigScopeBuilder(ConfigScopeProperty.CLUSTER).forCluster(
              _clusterId.stringify()).build();
      autoJoin =
          Boolean
              .parseBoolean(_configAccessor.get(scope, HelixManager.ALLOW_PARTICIPANT_AUTO_JOIN));
      LOG.info("instance: " + _participantId + " auto-joining " + _clusterId + " is " + autoJoin);
View Full Code Here

Examples of org.apache.helix.model.builder.HelixConfigScopeBuilder

    // Assert.assertFalse(result._thread.isAlive());
    Assert.assertTrue(null == manager.getHelixDataAccessor().getProperty(
        accessor.keyBuilder().liveInstance(instance2)));

    HelixConfigScope scope =
        new HelixConfigScopeBuilder(ConfigScopeProperty.CLUSTER).forCluster(CLUSTER_NAME).build();

    manager.getConfigAccessor().set(scope, ZKHelixManager.ALLOW_PARTICIPANT_AUTO_JOIN, "true");

    newParticipant = new MockParticipant(_zkaddr, CLUSTER_NAME, instance2);
    newParticipant.syncStart();
View Full Code Here

Examples of org.apache.helix.model.builder.HelixConfigScopeBuilder

   * @param keyValuePairs csv-formatted key-value pairs. e.g. k1=v1,k2=v2
   */
  public void setConfig(ConfigScopeProperty type, String scopeArgsCsv, String keyValuePairs) {
    // ConfigScope scope = new ConfigScopeBuilder().build(scopesKeyValuePairs);
    String[] scopeArgs = scopeArgsCsv.split("[\\s,]");
    HelixConfigScope scope = new HelixConfigScopeBuilder(type, scopeArgs).build();

    Map<String, String> keyValueMap = HelixUtil.parseCsvFormatedKeyValuePairs(keyValuePairs);
    _admin.setConfig(scope, keyValueMap);
  }
View Full Code Here

Examples of org.apache.helix.model.builder.HelixConfigScopeBuilder

    // // parse keys
    // String[] keys = keysStr.split("[\\s,]");
    // Set<String> keysSet = new HashSet<String>(Arrays.asList(keys));

    String[] scopeArgs = scopeArgsCsv.split("[\\s,]");
    HelixConfigScope scope = new HelixConfigScopeBuilder(type, scopeArgs).build();

    String[] keys = keysCsv.split("[\\s,]");

    _admin.removeConfig(scope, Arrays.asList(keys));
  }
View Full Code Here

Examples of org.apache.helix.model.builder.HelixConfigScopeBuilder

   */
  public String getConfig(ConfigScopeProperty type, String scopeArgsCsv, String keysCsv) {
    // ConfigScope scope = new ConfigScopeBuilder().build(scopesStr);

    String[] scopeArgs = scopeArgsCsv.split("[\\s,]");
    HelixConfigScope scope = new HelixConfigScopeBuilder(type, scopeArgs).build();

    String[] keys = keysCsv.split("[\\s,]");
    // parse keys
    // String[] keys = keysStr.split("[\\s,]");
    // Set<String> keysSet = new HashSet<String>(Arrays.asList(keys));
View Full Code Here

Examples of org.apache.helix.model.builder.HelixConfigScopeBuilder

    if (!_resourceThreadpoolSizeMap.containsKey(resourceName)) {
      int threadpoolSize = -1;
      ConfigAccessor configAccessor = manager.getConfigAccessor();
      if (configAccessor != null) {
        HelixConfigScope scope =
            new HelixConfigScopeBuilder(ConfigScopeProperty.RESOURCE)
                .forCluster(manager.getClusterName()).forResource(resourceName).build();

        String threadpoolSizeStr = configAccessor.get(scope, MAX_THREADS);
        try {
          if (threadpoolSizeStr != null) {
View Full Code Here

Examples of org.apache.helix.model.builder.HelixConfigScopeBuilder

  @Test
  public void TestThreadPoolSizeConfig() {
    HelixManager manager = _participants[0];
    ConfigAccessor accessor = manager.getConfigAccessor();
    HelixConfigScope scope =
        new HelixConfigScopeBuilder(ConfigScopeProperty.RESOURCE)
            .forCluster(manager.getClusterName()).forResource("NextDB").build();
    accessor.set(scope, HelixTaskExecutor.MAX_THREADS, "" + 12);

    _setupTool.addResourceToCluster(CLUSTER_NAME, "NextDB", 64, STATE_MODEL);
    _setupTool.rebalanceStorageCluster(CLUSTER_NAME, "NextDB", 3);
View Full Code Here

Examples of org.apache.helix.model.builder.HelixConfigScopeBuilder

      // participant config will override the cluster config.

      if (_manager.getInstanceType() == InstanceType.PARTICIPANT
          || _manager.getInstanceType() == InstanceType.CONTROLLER_PARTICIPANT) {
        scope =
            new HelixConfigScopeBuilder(ConfigScopeProperty.PARTICIPANT)
                .forCluster(_manager.getClusterName()).forParticipant(_manager.getInstanceName())
                .build();
        threadpoolSizeStr = configAccessor.get(scope, key);
      }

      if (threadpoolSizeStr == null) {
        scope =
            new HelixConfigScopeBuilder(ConfigScopeProperty.CLUSTER).forCluster(
                _manager.getClusterName()).build();
        threadpoolSizeStr = configAccessor.get(scope, key);
      }
    }
View Full Code Here

Examples of org.apache.helix.model.builder.HelixConfigScopeBuilder

      throws Exception {
    LOG.debug(_workerId + " becomes ONLINE from OFFLINE for " + _partition);
    ConfigAccessor clusterConfig = context.getManager().getConfigAccessor();
    HelixManager manager = context.getManager();
    HelixConfigScope clusterScope =
        new HelixConfigScopeBuilder(ConfigScopeProperty.CLUSTER).forCluster(
            manager.getClusterName()).build();
    String json = clusterConfig.get(clusterScope, message.getResourceId().stringify());
    Dag.Node node = Dag.Node.fromJson(json);
    Set<String> parentIds = node.getParentIds();
    ResourceId resourceId = message.getResourceId();
View Full Code Here

Examples of org.apache.helix.model.builder.HelixConfigScopeBuilder

    List<String> cmdConfigKeys = Arrays.asList(cmdKey, workingDirKey, timeoutKey, pidFileKey);

    // read command from resource-scope configures
    if (cmd == null) {
      HelixConfigScope resourceScope =
          new HelixConfigScopeBuilder(ConfigScopeProperty.RESOURCE).forCluster(clusterName)
              .forResource(message.getResourceId().stringify()).build();
      Map<String, String> cmdKeyValueMap =
          manager.getConfigAccessor().get(resourceScope, cmdConfigKeys);
      if (cmdKeyValueMap != null) {
        cmd = cmdKeyValueMap.get(cmdKey);
        workingDir = cmdKeyValueMap.get(workingDirKey);
        timeout = cmdKeyValueMap.get(timeoutKey);
        pidFile = cmdKeyValueMap.get(pidFileKey);
      }
    }

    // if resource-scope doesn't contain command, fall back to cluster-scope configures
    if (cmd == null) {
      HelixConfigScope clusterScope =
          new HelixConfigScopeBuilder(ConfigScopeProperty.CLUSTER).forCluster(clusterName).build();
      Map<String, String> cmdKeyValueMap =
          manager.getConfigAccessor().get(clusterScope, cmdConfigKeys);

      if (cmdKeyValueMap != null) {
        cmd = cmdKeyValueMap.get(cmdKey);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.