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


Java State.OPENING属性代码示例

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


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

示例1: isOpening

public boolean isOpening() {
  return state == State.OPENING;
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:3,代码来源:AssignmentManager.java

示例2: testRegionPlanIsUpdatedWhenRegionFailsToOpen

/**
 * TestCase verifies that the regionPlan is updated whenever a region fails to open
 * and the master tries to process RS_ZK_FAILED_OPEN state.(HBASE-5546).
 */
@Test
public void testRegionPlanIsUpdatedWhenRegionFailsToOpen() throws IOException, KeeperException,
    ServiceException, InterruptedException {
  this.server.getConfiguration().setClass(HConstants.HBASE_MASTER_LOADBALANCER_CLASS,
      MockedLoadBalancer.class, LoadBalancer.class);
  AssignmentManagerWithExtrasForTesting am = setUpMockedAssignmentManager(this.server,
      this.serverManager);
  try {
    // Boolean variable used for waiting until randomAssignment is called and new
    // plan is generated.
    AtomicBoolean gate = new AtomicBoolean(false);
    if (balancer instanceof MockedLoadBalancer) {
      ((MockedLoadBalancer) balancer).setGateVariable(gate);
    }
    ZKAssign.createNodeOffline(this.watcher, REGIONINFO, SERVERNAME_A);
    int v = ZKAssign.getVersion(this.watcher, REGIONINFO);
    ZKAssign.transitionNode(this.watcher, REGIONINFO, SERVERNAME_A, EventType.M_ZK_REGION_OFFLINE,
        EventType.RS_ZK_REGION_FAILED_OPEN, v);
    String path = ZKAssign.getNodeName(this.watcher, REGIONINFO.getEncodedName());
    RegionState state = new RegionState(REGIONINFO, State.OPENING, System.currentTimeMillis(),
        SERVERNAME_A);
    am.regionsInTransition.put(REGIONINFO.getEncodedName(), state);
    // a dummy plan inserted into the regionPlans. This plan is cleared and new one is formed
    am.regionPlans.put(REGIONINFO.getEncodedName(), new RegionPlan(REGIONINFO, null, SERVERNAME_A));
    RegionPlan regionPlan = am.regionPlans.get(REGIONINFO.getEncodedName());
    List<ServerName> serverList = new ArrayList<ServerName>(2);
    serverList.add(SERVERNAME_B);
    Mockito.when(this.serverManager.getOnlineServersList()).thenReturn(serverList);
    am.nodeDataChanged(path);
    // here we are waiting until the random assignment in the load balancer is called.
    while (!gate.get()) {
      Thread.sleep(10);
    }
    // new region plan may take some time to get updated after random assignment is called and
    // gate is set to true.
    RegionPlan newRegionPlan = am.regionPlans.get(REGIONINFO.getEncodedName());
    while (newRegionPlan == null) {
      Thread.sleep(10);
      newRegionPlan = am.regionPlans.get(REGIONINFO.getEncodedName());
    }
    // the new region plan created may contain the same RS as destination but it should
    // be new plan.
    assertNotSame("Same region plan should not come", regionPlan, newRegionPlan);
    assertTrue("Destnation servers should be different.", !(regionPlan.getDestination().equals(
      newRegionPlan.getDestination())));
    Mocking.waitForRegionOfflineInRIT(am, REGIONINFO.getEncodedName());
  } finally {
    this.server.getConfiguration().setClass(HConstants.HBASE_MASTER_LOADBALANCER_CLASS,
      DefaultLoadBalancer.class, LoadBalancer.class);
    am.shutdown();
  }
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:56,代码来源:TestAssignmentManager.java


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