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


Java ClientProtos.RegionLoadStats方法代码示例

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


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

示例1: updateStats

import org.apache.hadoop.hbase.protobuf.generated.ClientProtos; //导入方法依赖的package包/类
/**
 * Update the stats for the specified region if the result is an instance of {@link
 * ResultStatsUtil}
 *
 * @param r object that contains the result and possibly the statistics about the region
 * @param serverStats stats tracker to update from the result
 * @param server server from which the result was obtained
 * @param regionName full region name for the stats.
 * @return the underlying {@link Result} if the passed result is an {@link
 * ResultStatsUtil} or just returns the result;
 */
public static <T> T updateStats(T r, ServerStatisticTracker serverStats,
    ServerName server, byte[] regionName) {
  if (!(r instanceof Result)) {
    return r;
  }
  Result result = (Result) r;
  // early exit if there are no stats to collect
  ClientProtos.RegionLoadStats stats = result.getStats();
  if(stats == null){
    return r;
  }

  if (regionName != null) {
    serverStats.updateRegionStats(server, regionName, stats);
  }

  return r;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:30,代码来源:ResultStatsUtil.java

示例2: getRegionStats

import org.apache.hadoop.hbase.protobuf.generated.ClientProtos; //导入方法依赖的package包/类
/**
 * @return the current load statistics for the the region
 */
public ClientProtos.RegionLoadStats getRegionStats() {
  if (!regionStatsEnabled) {
    return null;
  }
  ClientProtos.RegionLoadStats.Builder stats = ClientProtos.RegionLoadStats.newBuilder();
  stats.setMemstoreLoad(
      (int) (Math.min(100, (this.memstoreSize.get() * 100) / this.memstoreFlushSize)));
  stats.setHeapOccupancy((int) rsServices.getHeapMemoryManager().getHeapOccupancyPercent() * 100);
  stats.setCompactionPressure((int) rsServices.getCompactionPressure() * 100 > 100 ?
      100 :
      (int) rsServices.getCompactionPressure() * 100);
  return stats.build();
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:17,代码来源:HRegion.java

示例3: buildActionResult

import org.apache.hadoop.hbase.protobuf.generated.ClientProtos; //导入方法依赖的package包/类
/**
 * Wrap a throwable to an action result.
 *
 * @param r
 * @return an action result builder
 */
public static ResultOrException.Builder buildActionResult(final ClientProtos.Result r,
    ClientProtos.RegionLoadStats stats) {
  ResultOrException.Builder builder = ResultOrException.newBuilder();
  if (r != null) builder.setResult(r);
  if(stats != null) builder.setLoadStats(stats);
  return builder;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:14,代码来源:ResponseConverter.java

示例4: updateServerStats

import org.apache.hadoop.hbase.protobuf.generated.ClientProtos; //导入方法依赖的package包/类
public void updateServerStats(ServerName serverName, byte[] regionName,
                              Object r) {
  if (!(r instanceof Result)) {
    return;
  }
  Result result = (Result) r;
  ClientProtos.RegionLoadStats stats = result.getStats();
  if(stats == null){
    return;
  }
  String name = serverName.getServerName() + "," + Bytes.toStringBinary(regionName);
  ConcurrentMap<byte[], RegionStats> rsStats = null;
  if (serverStats.containsKey(serverName)) {
    rsStats = serverStats.get(serverName);
  } else {
    rsStats = serverStats.putIfAbsent(serverName,
        new ConcurrentSkipListMap<byte[], RegionStats>(Bytes.BYTES_COMPARATOR));
    if (rsStats == null) {
      rsStats = serverStats.get(serverName);
    }
  }
  RegionStats regionStats = null;
  if (rsStats.containsKey(regionName)) {
    regionStats = rsStats.get(regionName);
  } else {
    regionStats = rsStats.putIfAbsent(regionName, new RegionStats(this.registry, name));
    if (regionStats == null) {
      regionStats = rsStats.get(regionName);
    }
  }
  regionStats.update(stats);
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:33,代码来源:MetricsConnection.java

示例5: update

import org.apache.hadoop.hbase.protobuf.generated.ClientProtos; //导入方法依赖的package包/类
/**
 * Good enough attempt. Last writer wins. It doesn't really matter which one gets to update,
 * as something gets set
 * @param region
 * @param currentStats
 */
public void update(byte[] region, ClientProtos.RegionLoadStats currentStats) {
  RegionStatistics regionStat = this.stats.get(region);
  if(regionStat == null){
    regionStat = new RegionStatistics();
    this.stats.put(region, regionStat);
  }

  regionStat.update(currentStats);
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:16,代码来源:ServerStatistics.java

示例6: update

import org.apache.hadoop.hbase.protobuf.generated.ClientProtos; //导入方法依赖的package包/类
private void update(ServerStatistics stats, int memstoreLoad, int heapOccupancy,
                    int compactionPressure) {
  ClientProtos.RegionLoadStats stat = ClientProtos.RegionLoadStats.newBuilder()
      .setMemstoreLoad(memstoreLoad)
      .setHeapOccupancy(heapOccupancy)
      .setCompactionPressure(compactionPressure)
          .build();
  stats.update(regionname, stat);
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:10,代码来源:TestClientExponentialBackoff.java

示例7: getRegionStats

import org.apache.hadoop.hbase.protobuf.generated.ClientProtos; //导入方法依赖的package包/类
/**
 * @return the current load statistics for the the region
 */
public ClientProtos.RegionLoadStats getRegionStats() {
    if (!regionStatsEnabled) {
        return null;
    }
    ClientProtos.RegionLoadStats.Builder stats = ClientProtos.RegionLoadStats.newBuilder();
    stats.setMemstoreLoad((int) (Math.min(100, (this.memstoreSize.get() * 100) / this
            .memstoreFlushSize)));
    stats.setHeapOccupancy((int) rsServices.getHeapMemoryManager().getHeapOccupancyPercent() * 100);
    return stats.build();
}
 
开发者ID:grokcoder,项目名称:pbase,代码行数:14,代码来源:HRegion.java

示例8: update

import org.apache.hadoop.hbase.protobuf.generated.ClientProtos; //导入方法依赖的package包/类
private void update(ServerStatistics stats, int memstoreLoad, int heapOccupancy) {
  ClientProtos.RegionLoadStats stat = ClientProtos.RegionLoadStats.newBuilder()
      .setMemstoreLoad(memstoreLoad)
      .setHeapOccupancy(heapOccupancy)
          .build();
  stats.update(regionname, stat);
}
 
开发者ID:grokcoder,项目名称:pbase,代码行数:8,代码来源:TestClientExponentialBackoff.java

示例9: getResultOrException

import org.apache.hadoop.hbase.protobuf.generated.ClientProtos; //导入方法依赖的package包/类
private static ResultOrException getResultOrException(
    final ClientProtos.Result r, final int index, final ClientProtos.RegionLoadStats stats) {
  return getResultOrException(ResponseConverter.buildActionResult(r, stats), index);
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:5,代码来源:RSRpcServices.java

示例10: update

import org.apache.hadoop.hbase.protobuf.generated.ClientProtos; //导入方法依赖的package包/类
public void update(ClientProtos.RegionLoadStats regionStatistics) {
  this.memstoreLoadHist.update(regionStatistics.getMemstoreLoad());
  this.heapOccupancyHist.update(regionStatistics.getHeapOccupancy());
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:5,代码来源:MetricsConnection.java

示例11: setStatistics

import org.apache.hadoop.hbase.protobuf.generated.ClientProtos; //导入方法依赖的package包/类
/**
 * Set load information about the region to the information about the result
 * @param loadStats statistics about the current region from which this was returned
 */
@InterfaceAudience.Private
public void setStatistics(ClientProtos.RegionLoadStats loadStats) {
  this.stats = loadStats;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:9,代码来源:Result.java

示例12: getResultOrException

import org.apache.hadoop.hbase.protobuf.generated.ClientProtos; //导入方法依赖的package包/类
private static ResultOrException getResultOrException(
        final ClientProtos.Result r, final int index, final ClientProtos.RegionLoadStats stats) {
    return getResultOrException(ResponseConverter.buildActionResult(r, stats), index);
}
 
开发者ID:grokcoder,项目名称:pbase,代码行数:5,代码来源:RSRpcServices.java

示例13: addResults

import org.apache.hadoop.hbase.protobuf.generated.ClientProtos; //导入方法依赖的package包/类
/**
 * Add load information about the region to the information about the result
 * @param loadStats statistics about the current region from which this was returned
 * @deprecated use {@link #setStatistics(ClientProtos.RegionLoadStats)} instead
 * @throws UnsupportedOperationException if invoked on instance of EMPTY_RESULT
 * (which is supposed to be immutable).
 */
@InterfaceAudience.Private
@Deprecated
public void addResults(ClientProtos.RegionLoadStats loadStats) {
  checkReadonly();
  this.stats = loadStats;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:14,代码来源:Result.java

示例14: getStats

import org.apache.hadoop.hbase.protobuf.generated.ClientProtos; //导入方法依赖的package包/类
/**
 * @return the associated statistics about the region from which this was returned. Can be
 * <tt>null</tt> if stats are disabled.
 */
public ClientProtos.RegionLoadStats getStats() {
  return stats;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:8,代码来源:Result.java

示例15: addResults

import org.apache.hadoop.hbase.protobuf.generated.ClientProtos; //导入方法依赖的package包/类
/**
 * Add load information about the region to the information about the result
 * @param loadStats statistics about the current region from which this was returned
 */
public void addResults(ClientProtos.RegionLoadStats loadStats) {
  this.stats = loadStats;
}
 
开发者ID:grokcoder,项目名称:pbase,代码行数:8,代码来源:Result.java


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