本文整理汇总了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;
}
示例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();
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}
示例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();
}
示例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);
}
示例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);
}
示例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());
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}