RateLimitingMergingViewProcessListener extends MergingViewProcessListener { public void terminate() { _taskSetupLock.lock(); try { cancelTimerTask(); } finally { _taskSetupLock.unlock(); } } RateLimitingMergingViewProcessListener(ViewResultListener underlying, EngineResourceManagerInternal<?> cycleManager, ScheduledExecutorService timer); void terminate(); boolean isPaused(); void setPaused(boolean isPaused); long getMinimumUpdatePeriodMillis(); void setMinimumUpdatePeriodMillis(long minimumUpdatePeriodMillis);  }
@Test public void testModifiableUpdatePeriod() throws InterruptedException { final ScheduledExecutorService executor = Executors.newScheduledThreadPool(1); try { final TestViewResultListener testListener = new TestViewResultListener(); final RateLimitingMergingViewProcessListener mergingListener = new RateLimitingMergingViewProcessListener(testListener, mock(EngineResourceManagerImpl.class), executor); assertCorrectUpdateRate(mergingListener, testListener, 100); assertCorrectUpdateRate(mergingListener, testListener, 400); assertCorrectUpdateRate(mergingListener, testListener, 50); mergingListener.terminate(); } finally { executor.shutdown(); } }