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


Java StorageClusterStatusModel.setAverageLoad方法代码示例

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


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

示例1: 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

示例2: get

import org.apache.hadoop.hbase.rest.model.StorageClusterStatusModel; //导入方法依赖的package包/类
@GET
@Produces({MIMETYPE_TEXT, MIMETYPE_XML, MIMETYPE_JSON, MIMETYPE_PROTOBUF,
  MIMETYPE_PROTOBUF_IETF})
public Response get(final @Context UriInfo uriInfo) {
  if (LOG.isDebugEnabled()) {
    LOG.debug("GET " + uriInfo.getAbsolutePath());
  }
  servlet.getMetrics().incrementRequests(1);
  try {
    ClusterStatus status = servlet.getAdmin().getClusterStatus();
    StorageClusterStatusModel model = new StorageClusterStatusModel();
    model.setRegions(status.getRegionsCount());
    model.setRequests(status.getRequestsCount());
    model.setAverageLoad(status.getAverageLoad());
    for (ServerName info: status.getServers()) {
      ServerLoad 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 (RegionLoad region: load.getRegionsLoad().values()) {
        node.addRegion(region.getName(), region.getStores(),
          region.getStorefiles(), region.getStorefileSizeMB(),
          region.getMemStoreSizeMB(), region.getStorefileIndexSizeMB(),
          region.getReadRequestsCount(), region.getWriteRequestsCount(),
          region.getRootIndexSizeKB(), region.getTotalStaticIndexSizeKB(),
          region.getTotalStaticBloomSizeKB(), region.getTotalCompactingKVs(),
          region.getCurrentCompactedKVs());
      }
    }
    for (ServerName name: status.getDeadServerNames()) {
      model.addDeadNode(name.toString());
    }
    ResponseBuilder response = Response.ok(model);
    response.cacheControl(cacheControl);
    servlet.getMetrics().incrementSucessfulGetRequests(1);
    return response.build();
  } catch (IOException e) {
    servlet.getMetrics().incrementFailedGetRequests(1);
    return Response.status(Response.Status.SERVICE_UNAVAILABLE)
      .type(MIMETYPE_TEXT).entity("Unavailable" + CRLF)
      .build();
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:48,代码来源:StorageClusterStatusResource.java

示例3: get

import org.apache.hadoop.hbase.rest.model.StorageClusterStatusModel; //导入方法依赖的package包/类
@GET
@Produces({MIMETYPE_TEXT, MIMETYPE_XML, MIMETYPE_JSON, MIMETYPE_PROTOBUF,
  MIMETYPE_PROTOBUF_IETF})
public Response get(final @Context UriInfo uriInfo) {
  if (LOG.isDebugEnabled()) {
    LOG.debug("GET " + uriInfo.getAbsolutePath());
  }
  servlet.getMetrics().incrementRequests(1);
  try {
    ClusterStatus status = servlet.getAdmin().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(),
          region.getReadRequestsCount(), region.getWriteRequestsCount(),
          region.getRootIndexSizeKB(), region.getTotalStaticIndexSizeKB(),
          region.getTotalStaticBloomSizeKB(), region.getTotalCompactingKVs(),
          region.getCurrentCompactedKVs());
      }
    }
    for (ServerName name: status.getDeadServerNames()) {
      model.addDeadNode(name.toString());
    }
    ResponseBuilder response = Response.ok(model);
    response.cacheControl(cacheControl);
    servlet.getMetrics().incrementSucessfulGetRequests(1);
    return response.build();
  } catch (IOException e) {
    servlet.getMetrics().incrementFailedGetRequests(1);
    return Response.status(Response.Status.SERVICE_UNAVAILABLE)
      .type(MIMETYPE_TEXT).entity("Unavailable" + CRLF)
      .build();
  }
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:48,代码来源:StorageClusterStatusResource.java

示例4: get

import org.apache.hadoop.hbase.rest.model.StorageClusterStatusModel; //导入方法依赖的package包/类
@GET
@Produces({MIMETYPE_TEXT, MIMETYPE_XML, MIMETYPE_JSON, MIMETYPE_PROTOBUF,
  MIMETYPE_PROTOBUF_IETF})
public Response get(final @Context UriInfo uriInfo) {
  if (LOG.isTraceEnabled()) {
    LOG.trace("GET " + uriInfo.getAbsolutePath());
  }
  servlet.getMetrics().incrementRequests(1);
  try {
    ClusterMetrics status = servlet.getAdmin().getClusterMetrics(
      EnumSet.of(Option.LIVE_SERVERS, Option.DEAD_SERVERS));
    StorageClusterStatusModel model = new StorageClusterStatusModel();
    model.setRegions(status.getRegionCount());
    model.setRequests(status.getRequestCount());
    model.setAverageLoad(status.getAverageLoad());
    for (Map.Entry<ServerName, ServerMetrics> entry: status.getLiveServerMetrics().entrySet()) {
      ServerName sn = entry.getKey();
      ServerMetrics load = entry.getValue();
      StorageClusterStatusModel.Node node =
        model.addLiveNode(
          sn.getHostname() + ":" +
          Integer.toString(sn.getPort()),
          sn.getStartcode(), (int) load.getUsedHeapSize().get(Size.Unit.MEGABYTE),
          (int) load.getMaxHeapSize().get(Size.Unit.MEGABYTE));
      node.setRequests(load.getRequestCount());
      for (RegionMetrics region: load.getRegionMetrics().values()) {
        node.addRegion(region.getRegionName(), region.getStoreCount(),
          region.getStoreFileCount(),
          (int) region.getStoreFileSize().get(Size.Unit.MEGABYTE),
          (int) region.getMemStoreSize().get(Size.Unit.MEGABYTE),
          (long) region.getStoreFileIndexSize().get(Size.Unit.KILOBYTE),
          region.getReadRequestCount(),
          region.getWriteRequestCount(),
          (int) region.getStoreFileRootLevelIndexSize().get(Size.Unit.KILOBYTE),
          (int) region.getStoreFileUncompressedDataIndexSize().get(Size.Unit.KILOBYTE),
          (int) region.getBloomFilterSize().get(Size.Unit.KILOBYTE),
          region.getCompactingCellCount(),
          region.getCompactedCellCount());
      }
    }
    for (ServerName name: status.getDeadServerNames()) {
      model.addDeadNode(name.toString());
    }
    ResponseBuilder response = Response.ok(model);
    response.cacheControl(cacheControl);
    servlet.getMetrics().incrementSucessfulGetRequests(1);
    return response.build();
  } catch (IOException e) {
    servlet.getMetrics().incrementFailedGetRequests(1);
    return Response.status(Response.Status.SERVICE_UNAVAILABLE)
      .type(MIMETYPE_TEXT).entity("Unavailable" + CRLF)
      .build();
  }
}
 
开发者ID:apache,项目名称:hbase,代码行数:55,代码来源:StorageClusterStatusResource.java


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