当前位置: 首页>>代码示例>>Java>>正文


Java ConfigAccessor.set方法代码示例

本文整理汇总了Java中org.apache.helix.ConfigAccessor.set方法的典型用法代码示例。如果您正苦于以下问题:Java ConfigAccessor.set方法的具体用法?Java ConfigAccessor.set怎么用?Java ConfigAccessor.set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.helix.ConfigAccessor的用法示例。


在下文中一共展示了ConfigAccessor.set方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setResourceThreadPoolSize

import org.apache.helix.ConfigAccessor; //导入方法依赖的package包/类
private void setResourceThreadPoolSize(String resourceName, int threadPoolSize) {
  HelixManager manager = _participants[0];
  ConfigAccessor accessor = manager.getConfigAccessor();
  HelixConfigScope scope =
      new HelixConfigScopeBuilder(HelixConfigScope.ConfigScopeProperty.RESOURCE)
          .forCluster(manager.getClusterName()).forResource(resourceName).build();
  accessor.set(scope, HelixTaskExecutor.MAX_THREADS, "" + threadPoolSize);
}
 
开发者ID:apache,项目名称:helix,代码行数:9,代码来源:TestResourceThreadpoolSize.java

示例2: testDisableResourceMonitoring

import org.apache.helix.ConfigAccessor; //导入方法依赖的package包/类
@Test
public void testDisableResourceMonitoring() throws Exception {
  final int NUM_PARTICIPANTS = 2;
  String clusterName = TestHelper.getTestClassName() + "_" + TestHelper.getTestMethodName();
  System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis()));

  // Set up cluster
  TestHelper.setupCluster(clusterName, ZK_ADDR, 12918, // participant port
      "localhost", // participant name prefix
      "TestDB", // resource name prefix
      3, // resources
      32, // partitions per resource
      4, // number of nodes
      1, // replicas
      "MasterSlave", RebalanceMode.FULL_AUTO, // use FULL_AUTO mode to test node tagging
      true); // do rebalance

  MockParticipantManager[] participants = new MockParticipantManager[NUM_PARTICIPANTS];
  for (int i = 0; i < NUM_PARTICIPANTS; i++) {
    participants[i] =
        new MockParticipantManager(ZK_ADDR, clusterName, "localhost_" + (12918 + i));
    participants[i].syncStart();
  }

  ConfigAccessor configAccessor = new ConfigAccessor(_gZkClient);
  HelixConfigScope resourceScope =
      new HelixConfigScopeBuilder(HelixConfigScope.ConfigScopeProperty.RESOURCE)
          .forCluster(clusterName).forResource("TestDB1").build();
  configAccessor
      .set(resourceScope, ResourceConfig.ResourceConfigProperty.MONITORING_DISABLED.name(),
          "true");

  resourceScope = new HelixConfigScopeBuilder(HelixConfigScope.ConfigScopeProperty.RESOURCE)
      .forCluster(clusterName).forResource("TestDB2").build();
  configAccessor
      .set(resourceScope, ResourceConfig.ResourceConfigProperty.MONITORING_DISABLED.name(),
          "false");

  ClusterControllerManager controller =
      new ClusterControllerManager(ZK_ADDR, clusterName, "controller_0");
  controller.syncStart();

  HelixClusterVerifier clusterVerifier =
      new BestPossibleExternalViewVerifier.Builder(clusterName).setZkClient(_gZkClient).build();
  Assert.assertTrue(clusterVerifier.verify());

  // Verify the bean was created for TestDB0, but not for TestDB1.
  Assert.assertTrue(_mbeanServer.isRegistered(getMbeanName("TestDB0", clusterName)));
  Assert.assertFalse(_mbeanServer.isRegistered(getMbeanName("TestDB1", clusterName)));
  Assert.assertTrue(_mbeanServer.isRegistered(getMbeanName("TestDB2", clusterName)));

  controller.syncStop();
  for (MockParticipantManager participant : participants) {
    participant.syncStop();
  }
  System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis()));
}
 
开发者ID:apache,项目名称:helix,代码行数:58,代码来源:TestDisableResourceMbean.java

示例3: TestThreadPoolSizeConfig

import org.apache.helix.ConfigAccessor; //导入方法依赖的package包/类
@Test
public void TestThreadPoolSizeConfig() {
  String instanceName = PARTICIPANT_PREFIX + "_" + (START_PORT + 0);
  HelixManager manager = _participants[0];

  ConfigAccessor accessor = manager.getConfigAccessor();
  ConfigScope scope =
      new ConfigScopeBuilder().forCluster(manager.getClusterName()).forParticipant(instanceName)
          .build();
  accessor.set(scope, "TestMsg." + HelixTaskExecutor.MAX_THREADS, "" + 12);

  scope = new ConfigScopeBuilder().forCluster(manager.getClusterName()).build();
  accessor.set(scope, "TestMsg." + HelixTaskExecutor.MAX_THREADS, "" + 8);

  for (int i = 0; i < NODE_NR; i++) {
    instanceName = PARTICIPANT_PREFIX + "_" + (START_PORT + i);

    _participants[i].getMessagingService().registerMessageHandlerFactory("TestMsg",
        new TestMessagingHandlerFactory());
    _participants[i].getMessagingService()
        .registerMessageHandlerFactory("TestMsg2", new TestMessagingHandlerFactory2());

  }

  for (int i = 0; i < NODE_NR; i++) {
    instanceName = PARTICIPANT_PREFIX + "_" + (START_PORT + i);

    DefaultMessagingService svc =
        (DefaultMessagingService) (_participants[i]
            .getMessagingService());
    HelixTaskExecutor helixExecutor = svc.getExecutor();
    ThreadPoolExecutor executor =
        (ThreadPoolExecutor) (helixExecutor._executorMap.get("TestMsg"));

    ThreadPoolExecutor executor2 =
        (ThreadPoolExecutor) (helixExecutor._executorMap.get("TestMsg2"));
    if (i != 0) {

      Assert.assertEquals(8, executor.getMaximumPoolSize());
    } else {
      Assert.assertEquals(12, executor.getMaximumPoolSize());
    }
    Assert.assertEquals(HelixTaskExecutor.DEFAULT_PARALLEL_TASKS, executor2.getMaximumPoolSize());
  }
}
 
开发者ID:apache,项目名称:helix,代码行数:46,代码来源:TestConfigThreadpoolSize.java


注:本文中的org.apache.helix.ConfigAccessor.set方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。