StatisticManager { public TimeSeriesMax maxQueLengthRecorder() { return maxQueueLength; } StatisticManager(Whiteboard whiteboard, ScheduledExecutorService executor); void logQueryEvaluationTime(String language, String statement, long millis); MeterStats getMeter(Type type); CounterStats getStatsCounter(Type type); TimerStats getTimer(Type type); TimeSeriesMax maxQueLengthRecorder(); void dispose();  }
@Test public void observationQueueMaxLength() { AtomicLong maxQueueLength = new AtomicLong(); SimpleStats stats = new SimpleStats(maxQueueLength, SimpleStats.Type.COUNTER); Whiteboard wb = new DefaultWhiteboard(); wb.register(StatisticsProvider.class, new DummyStatsProvider() { @Override public CounterStats getCounterStats(String name, StatsOptions options) { if (name.equals(RepositoryStats.OBSERVATION_QUEUE_MAX_LENGTH)) { return stats; } return super.getCounterStats(name, options); } }, null); StatisticManager mgr = new StatisticManager(wb, executorService); TimeSeriesMax rec = mgr.maxQueLengthRecorder(); List<Runnable> services = wb.track(Runnable.class).getServices(); assertEquals(1, services.size()); Runnable pulse = services.get(0); pulse.run(); assertEquals(-1L, maxQueueLength.get()); rec.recordValue(7); rec.recordValue(5); rec.recordValue(-1); assertEquals(7L, maxQueueLength.get()); pulse.run(); assertEquals(-1L, maxQueueLength.get()); }