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


Java StorageClusterStatusModel类代码示例

本文整理汇总了Java中org.apache.hadoop.hbase.rest.model.StorageClusterStatusModel的典型用法代码示例。如果您正苦于以下问题:Java StorageClusterStatusModel类的具体用法?Java StorageClusterStatusModel怎么用?Java StorageClusterStatusModel使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: validate

import org.apache.hadoop.hbase.rest.model.StorageClusterStatusModel; //导入依赖的package包/类
private static void validate(StorageClusterStatusModel model) {
  assertNotNull(model);
  assertTrue(model.getRegions() + ">= 1", model.getRegions() >= 1);
  assertTrue(model.getRequests() >= 0);
  assertTrue(model.getAverageLoad() >= 0.0);
  assertNotNull(model.getLiveNodes());
  assertNotNull(model.getDeadNodes());
  assertFalse(model.getLiveNodes().isEmpty());
  boolean foundMeta = false;
  for (StorageClusterStatusModel.Node node: model.getLiveNodes()) {
    assertNotNull(node.getName());
    assertTrue(node.getStartCode() > 0L);
    assertTrue(node.getRequests() >= 0);
    for (StorageClusterStatusModel.Node.Region region: node.getRegions()) {
      if (Bytes.equals(region.getName(), META_REGION_NAME)) {
        foundMeta = true;
      }
    }
  }
  assertTrue(foundMeta);
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:22,代码来源:TestStatusResource.java

示例2: validate

import org.apache.hadoop.hbase.rest.model.StorageClusterStatusModel; //导入依赖的package包/类
private static void validate(StorageClusterStatusModel model) {
  assertNotNull(model);
  assertTrue(model.getRegions() >= 1);
  assertTrue(model.getRequests() >= 0);
  assertTrue(model.getAverageLoad() >= 0.0);
  assertNotNull(model.getLiveNodes());
  assertNotNull(model.getDeadNodes());
  assertFalse(model.getLiveNodes().isEmpty());
  boolean foundRoot = false, foundMeta = false;
  for (StorageClusterStatusModel.Node node: model.getLiveNodes()) {
    assertNotNull(node.getName());
    assertTrue(node.getStartCode() > 0L);
    assertTrue(node.getRequests() >= 0);
    for (StorageClusterStatusModel.Node.Region region: node.getRegions()) {
      if (Bytes.equals(region.getName(), ROOT_REGION_NAME)) {
        foundRoot = true;
      } else if (Bytes.equals(region.getName(), META_REGION_NAME)) {
        foundMeta = true;
      }
    }
  }
  assertTrue(foundRoot);
  assertTrue(foundMeta);
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:25,代码来源:TestStatusResource.java

示例3: setUpBeforeClass

import org.apache.hadoop.hbase.rest.model.StorageClusterStatusModel; //导入依赖的package包/类
@BeforeClass
public static void setUpBeforeClass() throws Exception {
  conf = TEST_UTIL.getConfiguration();
  TEST_UTIL.startMiniCluster(1, 1);
  TEST_UTIL.createTable(TableName.valueOf("TestStatusResource"), Bytes.toBytes("D"));
  TEST_UTIL.createTable(TableName.valueOf("TestStatusResource2"), Bytes.toBytes("D"));
  REST_TEST_UTIL.startServletContainer(conf);
  Cluster cluster = new Cluster();
  cluster.add("localhost", REST_TEST_UTIL.getServletPort());
  client = new Client(cluster);
  context = JAXBContext.newInstance(StorageClusterStatusModel.class);
  TEST_UTIL.waitFor(6000, new Waiter.Predicate<IOException>() {
    @Override
    public boolean evaluate() throws IOException {
      return TEST_UTIL.getMiniHBaseCluster().getClusterStatus().getAverageLoad() > 0;
    }
  });
}
 
开发者ID:apache,项目名称:hbase,代码行数:19,代码来源:TestStatusResource.java

示例4: testClusterStatus

import org.apache.hadoop.hbase.rest.model.StorageClusterStatusModel; //导入依赖的package包/类
@Test
public void testClusterStatus() throws Exception {

  ClusterStatus status = TEST_UTIL.getHBaseClusterInterface()
      .getClusterStatus();
  StorageClusterStatusModel returnedStatus = remoteAdmin.getClusterStatus();
  assertEquals(
      "Region count from cluster status and returned status did not match up. ",
      status.getRegionsCount(), returnedStatus.getRegions());
  assertEquals(
      "Dead server count from cluster status and returned status did not match up. ",
      status.getDeadServers(), returnedStatus.getDeadNodes().size());
  assertEquals(
      "Number of requests from cluster status and returned status did not match up. ",
      status.getRequestsCount(), returnedStatus.getRequests());
}
 
开发者ID:zwqjsj0404,项目名称:HBase-Research,代码行数:17,代码来源:TestRemoteAdmin.java

示例5: getClusterStatus

import org.apache.hadoop.hbase.rest.model.StorageClusterStatusModel; //导入依赖的package包/类
/**
 * @return string representing the cluster's version
 * @throws IOException if the endpoint does not exist, there is a timeout, or some other general failure mode
 */
public StorageClusterStatusModel getClusterStatus() throws IOException {

    StringBuilder path = new StringBuilder();
    path.append('/');
    if (accessToken !=null) {
        path.append(accessToken);
        path.append('/');
    }

  path.append("status/cluster");

  int code = 0;
  for (int i = 0; i < maxRetries; i++) {
    Response response = client.get(path.toString(),
        Constants.MIMETYPE_PROTOBUF);
    code = response.getCode();
    switch (code) {
    case 200:
      StorageClusterStatusModel s = new StorageClusterStatusModel();
      return (StorageClusterStatusModel) s.getObjectFromMessage(response
          .getBody());
    case 404:
      throw new IOException("Cluster version not found");
    case 509:
      try {
        Thread.sleep(sleepTime);
      } catch (InterruptedException e) {
        throw (InterruptedIOException)new InterruptedIOException().initCause(e);
      }
      break;
    default:
      throw new IOException("get request to " + path + " returned " + code);
    }
  }
  throw new IOException("get request to " + path + " timed out");
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:41,代码来源:RemoteAdmin.java

示例6: setUpBeforeClass

import org.apache.hadoop.hbase.rest.model.StorageClusterStatusModel; //导入依赖的package包/类
@BeforeClass
public static void setUpBeforeClass() throws Exception {
  TEST_UTIL.startMiniCluster();
  REST_TEST_UTIL.startServletContainer(TEST_UTIL.getConfiguration());
  client = new Client(new Cluster().add("localhost", 
    REST_TEST_UTIL.getServletPort()));
  context = JAXBContext.newInstance(StorageClusterStatusModel.class);
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:9,代码来源:TestStatusResource.java

示例7: testGetClusterStatusXML

import org.apache.hadoop.hbase.rest.model.StorageClusterStatusModel; //导入依赖的package包/类
@Test
public void testGetClusterStatusXML() throws IOException, JAXBException {
  Response response = client.get("/status/cluster", Constants.MIMETYPE_XML);
  assertEquals(response.getCode(), 200);
  assertEquals(Constants.MIMETYPE_XML, response.getHeader("content-type"));
  StorageClusterStatusModel model = (StorageClusterStatusModel)
    context.createUnmarshaller().unmarshal(
      new ByteArrayInputStream(response.getBody()));
  validate(model);
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:11,代码来源:TestStatusResource.java

示例8: getClusterStatus

import org.apache.hadoop.hbase.rest.model.StorageClusterStatusModel; //导入依赖的package包/类
/**
 * @return string representing the cluster's version
 * @throws IOEXception if the endpoint does not exist, there is a timeout, or some other general failure mode
 */
public StorageClusterStatusModel getClusterStatus() throws IOException {

    StringBuilder path = new StringBuilder();
    path.append('/');
    if (accessToken !=null) {
        path.append(accessToken);
        path.append('/');
    }

  path.append("status/cluster");

  int code = 0;
  for (int i = 0; i < maxRetries; i++) {
    Response response = client.get(path.toString(),
        Constants.MIMETYPE_PROTOBUF);
    code = response.getCode();
    switch (code) {
    case 200:
      StorageClusterStatusModel s = new StorageClusterStatusModel();
      return (StorageClusterStatusModel) s.getObjectFromMessage(response
          .getBody());
    case 404:
      throw new IOException("Cluster version not found");
    case 509:
      try {
        Thread.sleep(sleepTime);
      } catch (InterruptedException e) {
      }
      break;
    default:
      throw new IOException("get request to " + path + " returned " + code);
    }
  }
  throw new IOException("get request to " + path + " timed out");
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:40,代码来源:RemoteAdmin.java

示例9: testClusterStatus

import org.apache.hadoop.hbase.rest.model.StorageClusterStatusModel; //导入依赖的package包/类
@Test
public void testClusterStatus() throws Exception {

  ClusterStatus status = TEST_UTIL.getHBaseClusterInterface()
      .getClusterStatus();
  StorageClusterStatusModel returnedStatus = remoteAdmin.getClusterStatus();
  assertEquals(
      "Region count from cluster status and returned status did not match up. ",
      status.getRegionsCount(), returnedStatus.getRegions());
  assertEquals(
      "Dead server count from cluster status and returned status did not match up. ",
      status.getDeadServers(), returnedStatus.getDeadNodes().size());
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:14,代码来源:TestRemoteAdmin.java

示例10: testGetClusterStatusXML

import org.apache.hadoop.hbase.rest.model.StorageClusterStatusModel; //导入依赖的package包/类
@Test
public void testGetClusterStatusXML() throws IOException, JAXBException {
  Response response = client.get("/status/cluster", Constants.MIMETYPE_XML);
  assertEquals(200, response.getCode());
  assertEquals(Constants.MIMETYPE_XML, response.getHeader("content-type"));
  StorageClusterStatusModel model = (StorageClusterStatusModel)
    context.createUnmarshaller().unmarshal(
      new ByteArrayInputStream(response.getBody()));
  validate(model);
}
 
开发者ID:apache,项目名称:hbase,代码行数:11,代码来源:TestStatusResource.java

示例11: get

import org.apache.hadoop.hbase.rest.model.StorageClusterStatusModel; //导入依赖的package包/类
@GET
@Produces({MIMETYPE_TEXT, MIMETYPE_XML, MIMETYPE_JSON, MIMETYPE_PROTOBUF})
public Response get(final @Context UriInfo uriInfo) {
  if (LOG.isDebugEnabled()) {
    LOG.debug("GET " + uriInfo.getAbsolutePath());
  }
  servlet.getMetrics().incrementRequests(1);
  try {
    HBaseAdmin admin = new HBaseAdmin(servlet.getConfiguration());
    ClusterStatus status = admin.getClusterStatus();
    StorageClusterStatusModel model = new StorageClusterStatusModel();
    model.setRegions(status.getRegionsCount());
    model.setRequests(status.getRequestsCount());
    model.setAverageLoad(status.getAverageLoad());
    for (ServerName info: status.getServers()) {
      HServerLoad load = status.getLoad(info);
      StorageClusterStatusModel.Node node =
        model.addLiveNode(
          info.getHostname() + ":" +
          Integer.toString(info.getPort()),
          info.getStartcode(), load.getUsedHeapMB(),
          load.getMaxHeapMB());
      node.setRequests(load.getNumberOfRequests());
      for (HServerLoad.RegionLoad region: load.getRegionsLoad().values()) {
        node.addRegion(region.getName(), region.getStores(),
          region.getStorefiles(), region.getStorefileSizeMB(),
          region.getMemStoreSizeMB(), region.getStorefileIndexSizeMB());
      }
    }
    for (ServerName name: status.getDeadServerNames()) {
      model.addDeadNode(name.toString());
    }
    ResponseBuilder response = Response.ok(model);
    response.cacheControl(cacheControl);
    return response.build();
  } catch (IOException e) {
    throw new WebApplicationException(e, 
                Response.Status.SERVICE_UNAVAILABLE);
  }
}
 
开发者ID:lifeng5042,项目名称:RStore,代码行数:41,代码来源:StorageClusterStatusResource.java

示例12: getClusterStatus

import org.apache.hadoop.hbase.rest.model.StorageClusterStatusModel; //导入依赖的package包/类
/**
 * @return string representing the cluster's version
 * @throws IOEXception if the endpoint does not exist, there is a timeout, or some other general failure mode
 */
public StorageClusterStatusModel getClusterStatus() throws IOException {

    StringBuilder path = new StringBuilder();
    path.append('/');
    if (accessToken !=null) {
        path.append(accessToken);
        path.append('/');
    }

  path.append("status/cluster");

  int code = 0;
  for (int i = 0; i < maxRetries; i++) {
    Response response = client.get(path.toString(),
        Constants.MIMETYPE_PROTOBUF);
    code = response.getCode();
    switch (code) {
    case 200:
      StorageClusterStatusModel s = new StorageClusterStatusModel();
      return (StorageClusterStatusModel) s.getObjectFromMessage(response
          .getBody());
    case 404:
      throw new IOException("Cluster version not found");
    case 509:
      try {
        Thread.sleep(sleepTime);
      } catch (InterruptedException e) {
        throw (InterruptedIOException)new InterruptedIOException().initCause(e);
      }
      break;
    default:
      throw new IOException("get request to " + path + " returned " + code);
    }
  }
  throw new IOException("get request to " + path + " timed out");
}
 
开发者ID:shenli-uiuc,项目名称:PyroDB,代码行数:41,代码来源:RemoteAdmin.java


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