final ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor(2);
// Record latencies on a "regular" basis. This will tend to record semi-reliably at
// each interval as long as the JVM doesn't stall.
executor.scheduleWithFixedDelay(new Recorder(), RECORDING_INTERVAL, RECORDING_INTERVAL, TimeUnit.NANOSECONDS);
// Regularly report o observations:
executor.scheduleWithFixedDelay(new Reporter(), REPORTING_INTERVAL, REPORTING_INTERVAL, TimeUnit.NANOSECONDS);
while (true);