org.apache.hadoop.hbase.tmpl.master.AssignmentManagerStatusTmplImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of hbase-server Show documentation
Show all versions of hbase-server Show documentation
Server functionality for HBase
// Autogenerated Jamon implementation
// /Users/mantonov/hbase/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/master/AssignmentManagerStatusTmpl.jamon
package org.apache.hadoop.hbase.tmpl.master;
// 20, 1
import org.apache.hadoop.hbase.HRegionInfo;
// 21, 1
import org.apache.hadoop.hbase.master.AssignmentManager;
// 22, 1
import org.apache.hadoop.hbase.master.RegionState;
// 23, 1
import org.apache.hadoop.conf.Configuration;
// 24, 1
import org.apache.hadoop.hbase.HBaseConfiguration;
// 25, 1
import org.apache.hadoop.hbase.HConstants;
// 26, 1
import java.util.Iterator;
// 27, 1
import java.util.Map;
public class AssignmentManagerStatusTmplImpl
extends org.jamon.AbstractTemplateImpl
implements org.apache.hadoop.hbase.tmpl.master.AssignmentManagerStatusTmpl.Intf
{
private final AssignmentManager assignmentManager;
private final int limit;
protected static org.apache.hadoop.hbase.tmpl.master.AssignmentManagerStatusTmpl.ImplData __jamon_setOptionalArguments(org.apache.hadoop.hbase.tmpl.master.AssignmentManagerStatusTmpl.ImplData p_implData)
{
if(! p_implData.getLimit__IsNotDefault())
{
p_implData.setLimit(100);
}
return p_implData;
}
public AssignmentManagerStatusTmplImpl(org.jamon.TemplateManager p_templateManager, org.apache.hadoop.hbase.tmpl.master.AssignmentManagerStatusTmpl.ImplData p_implData)
{
super(p_templateManager, __jamon_setOptionalArguments(p_implData));
assignmentManager = p_implData.getAssignmentManager();
limit = p_implData.getLimit();
}
@Override public void renderNoFlush(final java.io.Writer jamonWriter)
throws java.io.IOException
{
// 33, 1
Map rit = assignmentManager
.getRegionStates().getRegionsInTransition();
// process the map to find region in transition details
Configuration conf = HBaseConfiguration.create();
int ritThreshold = conf.getInt(HConstants.METRICS_RIT_STUCK_WARNING_THRESHOLD, 60000);
int numOfRITOverThreshold = 0;
long maxRITTime = Long.MIN_VALUE;
long currentTime = System.currentTimeMillis();
String regionIDForOldestRIT = ""; // avoiding null
for (Map.Entry e : rit.entrySet()) {
long ritTime = currentTime - e.getValue().getStamp();
if(ritTime > ritThreshold) {
numOfRITOverThreshold++;
}
if(maxRITTime < ritTime) {
maxRITTime = ritTime;
regionIDForOldestRIT = e.getKey();
}
}
int totalRITs = rit.size();
int toRemove = rit.size() - limit;
int removed = 0;
if (toRemove > 0) {
// getRegionsInTransition returned a copy, so we can mutate it
for (Iterator> it = rit.entrySet().iterator();
it.hasNext() && toRemove > 0;
) {
Map.Entry e = it.next();
if (HRegionInfo.FIRST_META_REGIONINFO.getEncodedName().equals(
e.getKey()) ||
regionIDForOldestRIT.equals(e.getKey())) {
// don't remove the meta & the oldest rit regions, they're too interesting!
continue;
}
it.remove();
toRemove--;
removed++;
}
}
// 78, 1
if (!rit.isEmpty() )
{
// 78, 23
jamonWriter.write("\n \n Regions in Transition
\n \n Region State RIT time (ms) \n ");
// 83, 13
for (Map.Entry entry : rit.entrySet() )
{
// 83, 75
jamonWriter.write("\n ");
// 84, 13
if (regionIDForOldestRIT.equals(entry.getKey()) )
{
// 84, 64
jamonWriter.write("\n \n ");
}
// 86, 13
else
{
// 86, 20
jamonWriter.write("\n \n ");
}
// 88, 19
jamonWriter.write("\n ");
// 89, 17
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(entry.getKey()), jamonWriter);
// 89, 37
jamonWriter.write(" ");
// 89, 46
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(entry.getValue().toDescriptiveString()), jamonWriter);
// 89, 90
jamonWriter.write(" \n ");
// 90, 9
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf((currentTime - entry.getValue().getStamp())), jamonWriter);
// 90, 58
jamonWriter.write(" \n ");
}
// 91, 20
jamonWriter.write("\n ");
// 92, 13
if (numOfRITOverThreshold > 0 )
{
// 92, 46
jamonWriter.write("\n \n ");
}
// 94, 13
else
{
// 94, 20
jamonWriter.write("\n \n ");
}
// 96, 19
jamonWriter.write("\n Total number of Regions in Transition for more than ");
// 97, 69
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(ritThreshold), jamonWriter);
// 97, 87
jamonWriter.write(" milliseconds ");
// 97, 110
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(numOfRITOverThreshold), jamonWriter);
// 97, 137
jamonWriter.write(" \n \n Total number of Regions in Transition ");
// 99, 61
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(totalRITs), jamonWriter);
// 99, 76
jamonWriter.write(" \n
\n ");
// 101, 5
if (removed > 0 )
{
// 101, 24
jamonWriter.write("\n (");
// 102, 6
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(removed), jamonWriter);
// 102, 19
jamonWriter.write(" more regions in transition not shown)\n ");
}
// 103, 11
jamonWriter.write("\n \n");
}
// 105, 7
jamonWriter.write("\n\n");
}
}