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


Java HConnectionImplementation.getClient方法代码示例

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


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

示例1: testClusterStatus

import org.apache.hadoop.hbase.client.ConnectionManager.HConnectionImplementation; //导入方法依赖的package包/类
@Ignore @Test (expected = RegionServerStoppedException.class)
public void testClusterStatus() throws Exception {

  TableName tn =
      TableName.valueOf("testClusterStatus");
  byte[] cf = "cf".getBytes();
  byte[] rk = "rk1".getBytes();

  JVMClusterUtil.RegionServerThread rs = TEST_UTIL.getHBaseCluster().startRegionServer();
  rs.waitForServerOnline();
  final ServerName sn = rs.getRegionServer().getServerName();

  HTable t = TEST_UTIL.createTable(tn, cf);
  TEST_UTIL.waitTableAvailable(tn);

  while(TEST_UTIL.getHBaseCluster().getMaster().getAssignmentManager().
      getRegionStates().isRegionsInTransition()){
    Thread.sleep(1);
  }
  final HConnectionImplementation hci =  (HConnectionImplementation)t.getConnection();
  while (t.getRegionLocation(rk).getPort() != sn.getPort()){
    TEST_UTIL.getHBaseAdmin().move(t.getRegionLocation(rk).getRegionInfo().
        getEncodedNameAsBytes(), Bytes.toBytes(sn.toString()));
    while(TEST_UTIL.getHBaseCluster().getMaster().getAssignmentManager().
        getRegionStates().isRegionsInTransition()){
      Thread.sleep(1);
    }
    hci.clearRegionCache(tn);
  }
  Assert.assertNotNull(hci.clusterStatusListener);
  TEST_UTIL.assertRegionOnServer(t.getRegionLocation(rk).getRegionInfo(), sn, 20000);

  Put p1 = new Put(rk);
  p1.add(cf, "qual".getBytes(), "val".getBytes());
  t.put(p1);

  rs.getRegionServer().abort("I'm dead");

  // We want the status to be updated. That's a least 10 second
  TEST_UTIL.waitFor(40000, 1000, true, new Waiter.Predicate<Exception>() {
    @Override
    public boolean evaluate() throws Exception {
      return TEST_UTIL.getHBaseCluster().getMaster().getServerManager().
          getDeadServers().isDeadServer(sn);
    }
  });

  TEST_UTIL.waitFor(40000, 1000, true, new Waiter.Predicate<Exception>() {
    @Override
    public boolean evaluate() throws Exception {
      return hci.clusterStatusListener.isDeadServer(sn);
    }
  });

  t.close();
  hci.getClient(sn);  // will throw an exception: RegionServerStoppedException
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:58,代码来源:TestHCM.java

示例2: testClusterStatus

import org.apache.hadoop.hbase.client.ConnectionManager.HConnectionImplementation; //导入方法依赖的package包/类
@Ignore @Test(expected = RegionServerStoppedException.class)
public void testClusterStatus() throws Exception {
  if (!isJavaOk){
    // This test requires jdk 1.7+
    throw new RegionServerStoppedException("as expected by the test...");
  }

  TableName tn =
      TableName.valueOf("testClusterStatus");
  byte[] cf = "cf".getBytes();
  byte[] rk = "rk1".getBytes();

  JVMClusterUtil.RegionServerThread rs = TEST_UTIL.getHBaseCluster().startRegionServer();
  rs.waitForServerOnline();
  final ServerName sn = rs.getRegionServer().getServerName();

  HTable t = TEST_UTIL.createTable(tn, cf);
  TEST_UTIL.waitTableAvailable(tn);

  while(TEST_UTIL.getHBaseCluster().getMaster().getAssignmentManager().
      getRegionStates().isRegionsInTransition()){
    Thread.sleep(1);
  }
  final HConnectionImplementation hci =  (HConnectionImplementation)t.getConnection();
  while (t.getRegionLocation(rk).getPort() != sn.getPort()){
    TEST_UTIL.getHBaseAdmin().move(t.getRegionLocation(rk).getRegionInfo().
        getEncodedNameAsBytes(), Bytes.toBytes(sn.toString()));
    while(TEST_UTIL.getHBaseCluster().getMaster().getAssignmentManager().
        getRegionStates().isRegionsInTransition()){
      Thread.sleep(1);
    }
    hci.clearRegionCache(tn);
  }
  Assert.assertNotNull(hci.clusterStatusListener);
  TEST_UTIL.assertRegionOnServer(t.getRegionLocation(rk).getRegionInfo(), sn, 20000);

  Put p1 = new Put(rk);
  p1.add(cf, "qual".getBytes(), "val".getBytes());
  t.put(p1);

  rs.getRegionServer().abort("I'm dead");

  // We want the status to be updated. That's a least 10 second
  TEST_UTIL.waitFor(40000, 1000, true, new Waiter.Predicate<Exception>() {
    @Override
    public boolean evaluate() throws Exception {
      return TEST_UTIL.getHBaseCluster().getMaster().getServerManager().
          getDeadServers().isDeadServer(sn);
    }
  });

  TEST_UTIL.waitFor(40000, 1000, true, new Waiter.Predicate<Exception>() {
    @Override
    public boolean evaluate() throws Exception {
      return hci.clusterStatusListener.isDeadServer(sn);
    }
  });

  t.close();
  hci.getClient(sn);  // will throw an exception: RegionServerStoppedException
}
 
开发者ID:grokcoder,项目名称:pbase,代码行数:62,代码来源:TestHCM.java

示例3: testClusterStatus

import org.apache.hadoop.hbase.client.ConnectionManager.HConnectionImplementation; //导入方法依赖的package包/类
@Test(expected = RegionServerStoppedException.class)
public void testClusterStatus() throws Exception {
  TableName tn =
      TableName.valueOf("testClusterStatus");
  byte[] cf = "cf".getBytes();
  byte[] rk = "rk1".getBytes();

  JVMClusterUtil.RegionServerThread rs = TEST_UTIL.getHBaseCluster().startRegionServer();
  rs.waitForServerOnline();
  final ServerName sn = rs.getRegionServer().getServerName();

  HTable t = TEST_UTIL.createTable(tn, cf);
  TEST_UTIL.waitTableAvailable(tn.getName());

  while(TEST_UTIL.getHBaseCluster().getMaster().getAssignmentManager().
      getRegionStates().isRegionsInTransition()){
    Thread.sleep(1);
  }
  final HConnectionImplementation hci =  (HConnectionImplementation)t.getConnection();
  while (t.getRegionLocation(rk).getPort() != sn.getPort()){
    TEST_UTIL.getHBaseAdmin().move(t.getRegionLocation(rk).getRegionInfo().
        getEncodedNameAsBytes(), Bytes.toBytes(sn.toString()));
    while(TEST_UTIL.getHBaseCluster().getMaster().getAssignmentManager().
        getRegionStates().isRegionsInTransition()){
      Thread.sleep(1);
    }
    hci.clearRegionCache(tn);
  }
  Assert.assertNotNull(hci.clusterStatusListener);
  TEST_UTIL.assertRegionOnServer(t.getRegionLocation(rk).getRegionInfo(), sn, 20000);

  Put p1 = new Put(rk);
  p1.add(cf, "qual".getBytes(), "val".getBytes());
  t.put(p1);

  rs.getRegionServer().abort("I'm dead");

  // We want the status to be updated. That's a least 10 second
  TEST_UTIL.waitFor(40000, 1000, true, new Waiter.Predicate<Exception>() {
    @Override
    public boolean evaluate() throws Exception {
      return TEST_UTIL.getHBaseCluster().getMaster().getServerManager().
          getDeadServers().isDeadServer(sn);
    }
  });

  TEST_UTIL.waitFor(40000, 1000, true, new Waiter.Predicate<Exception>() {
    @Override
    public boolean evaluate() throws Exception {
      return hci.clusterStatusListener.isDeadServer(sn);
    }
  });

  t.close();
  hci.getClient(sn);  // will throw an exception: RegionServerStoppedException
}
 
开发者ID:shenli-uiuc,项目名称:PyroDB,代码行数:57,代码来源:TestHCM.java


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