long now = System.currentTimeMillis();
for(ClientRequester request : requests) {
if(request.isFinished() || request.isCancelled())
continue;
row = table.addChild("tr");
RequestClient client = request.getClient();
row.addChild("td", client.toString());
try {
String s = request.toString();
if(s.indexOf(':') > s.indexOf('@')) {
s = s.substring(0, s.indexOf(':'));
}
row.addChild("td", s);
} catch (Throwable t) {
// FIXME shouldn't happen...
row.addChild("td", "ERROR: "+request.getClass().toString());
}
long diff = now - request.creationTime;
StringBuilder sb = new StringBuilder();
sb.append(TimeUtil.formatTime(diff, 2));
row.addChild("td", sb.toString());
row.addChild("td", Short.toString(request.getPriorityClass()));
row.addChild("td", client==null ? "?" : Boolean.toString(client.realTimeFlag()));
FreenetURI uri = request.getURI(); // getURI() sometimes returns null, eg for ClientPutters
row.addChild("td", uri == null ? "null" : uri.toString());
}
}