for (Object arg : args) {
trace += arg + " ";
}
- System.out.println(trace);
+ long now = System.currentTimeMillis();
+ System.out.println(StringUtils.fromTime(now) + ": " + trace);
Object rep = null;
- Exception oops = null;
try {
rep = doRequest(action, command, args, rw, whitelist);
- } catch (Exception e) {
- oops = e;
+ } catch (IOException e) {
+ rep = new RemoteLibraryException(e);
}
commands.put(id, command);
rws.put(id, rw);
times.put(id, (new Date().getTime() - start));
- if (oops != null) {
- throw oops;
- }
-
return rep;
}
String rec = StringUtils.formatNumber(bytesReceived) + "b";
String sent = StringUtils.formatNumber(bytesSent) + "b";
- System.out.println(String.format("%s[>%s]: (%s sent, %s rec) in %d ms",
- display(whitelist, rw), commands.get(id), sent, rec,
- times.get(id)));
+ long now = System.currentTimeMillis();
+ System.out.println(StringUtils.fromTime(now)
+ + ": "
+ + String.format("%s[>%s]: (%s sent, %s rec) in %d ms",
+ display(whitelist, rw), commands.get(id), sent, rec,
+ times.get(id)));
commands.remove(id);
times.remove(id);
@Override
protected void onError(Exception e) {
if (e instanceof SSLException) {
- System.out.println("[Client connection refused (bad key)]");
+ long now = System.currentTimeMillis();
+ System.out.println(StringUtils.fromTime(now) + ": "
+ + "[Client connection refused (bad key)]");
} else {
getTraceHandler().error(e);
}