in mqtt-client/src/main/java/com/aws/sample/amazonmq/MQTTClient.java [157:168]
private static void registerShutdownHook(final WrapInt count, final long ds, final int interval) {
Thread shutdown = new Thread(new Runnable(){
long d = ds;
double rate_theor = interval > 0 ? 1000.0 / interval : 0;
public void run() {
long delta = System.currentTimeMillis() - d;
System.err.print(String.format("\nMessages: %d Seconds: %f Rate: %f/sec vs %f/sec", count.v, delta/1000.0, 1000.0*count.v/delta, rate_theor));
}
});
Runtime.getRuntime().addShutdownHook(shutdown);
}