"
+ hoursSinceDecommStarted + " hrs " + remainderMinutes + " mins"
+ "\n");
}
public void generateNodeData( JspWriter out, DatanodeDescriptor d,
String suffix, boolean alive,
int nnHttpPort )
throws IOException {
/* Say the datanode is dn1.hadoop.apache.org with ip 192.168.0.5
we use:
1) d.getHostName():d.getPort() to display.
Domain and port are stripped if they are common across the nodes.
i.e. "dn1"
2) d.getHost():d.Port() for "title".
i.e. "192.168.0.5:50010"
3) d.getHostName():d.getInfoPort() for url.
i.e. "http://dn1.hadoop.apache.org:50075/..."
Note that "d.getHost():d.getPort()" is what DFS clients use
to interact with datanodes.
*/
// from nn_browsedfscontent.jsp:
String url = "http://" + d.getHostName() + ":" + d.getInfoPort() +
"/browseDirectory.jsp?namenodeInfoPort=" +
nnHttpPort + "&dir=" +
URLEncoder.encode("/", "UTF-8");
String name = d.getHostName() + ":" + d.getPort();
if ( !name.matches( "\\d+\\.\\d+.\\d+\\.\\d+.*" ) )
name = name.replaceAll( "\\.[^.:]*", "" );
int idx = (suffix != null && name.endsWith( suffix )) ?
name.indexOf( suffix ) : -1;
out.print( rowTxt() + "
" +
(( idx > 0 ) ? name.substring(0, idx) : name) + "" +
(( alive ) ? "" : "\n") );
if ( !alive )
return;
long c = d.getCapacity();
long u = d.getDfsUsed();
long nu = d.getNonDfsUsed();
long r = d.getRemaining();
String percentUsed = StringUtils.limitDecimalTo2(d.getDfsUsedPercent());
String percentRemaining = StringUtils.limitDecimalTo2(d.getRemainingPercent());
String adminState = (d.isDecommissioned() ? "Decommissioned" :
(d.isDecommissionInProgress() ? "Decommission In Progress":
"In Service"));
long timestamp = d.getLastUpdate();
long currentTime = System.currentTimeMillis();
out.print("
\n");
if (decommissioning.size() > 0) {
out.print("
"
+ "
Node
Last Contact
Under Replicated Blocks
Blocks With No Live Replicas
Under Replicated Blocks In Files Under Construction"
+ "
Time Since Decommissioning Started"
);
jspHelper.sortNodeList(decommissioning, "name", "ASC");
for (int i = 0; i < decommissioning.size(); i++) {
generateDecommissioningNodeData(out, decommissioning.get(i),
port_suffix, true, nnHttpPort);
}
out.print("