@Test public void rescheduling() throws Exception { repeatTest(10, new Callable<Object>() { @Override public Object call() throws Exception { log = new DesiredRateEventLog(10); SourceDesiredRateDecoupler decoupler = new PassiveScanDecoupler(PVManager.getReadScannerExecutorService(), TimeDuration.ofHertz(20), log); log.setDecoupler(decoupler); decoupler.start(); Thread.sleep(60); long startTime = System.nanoTime(); for (int i = 0; i < 4*5+2; i++) { decoupler.newValueEvent(); Thread.sleep(10); } long period = System.nanoTime() - startTime; Thread.sleep(100); decoupler.stop(); int expectedEvents = (int) (period / 50000000) + 1 + 1; assertThat(log.getEvents().size(), isOneOf(expectedEvents, expectedEvents + 1)); return null; } }); }
@Override void newValueEvent() { newEvent(DesiredRateEvent.Type.VALUE); }
PassiveScanDecoupler extends SourceDesiredRateDecoupler { @Override void newValueEvent() { newEvent(DesiredRateEvent.Type.VALUE); } }
PassiveScanDecoupler extends SourceDesiredRateDecoupler { @Override void newValueEvent() { newEvent(DesiredRateEvent.Type.VALUE); } PassiveScanDecoupler(ScheduledExecutorService scannerExecutor,
            Duration maxDuration, DesiredRateEventListener listener); }
PassiveScanDecoupler extends SourceDesiredRateDecoupler { @Override void newValueEvent() { newEvent(DesiredRateEvent.Type.VALUE); } PassiveScanDecoupler(ScheduledExecutorService scannerExecutor,
            Duration maxDuration, DesiredRateEventListener listener);  }
PassiveScanDecoupler extends SourceDesiredRateDecoupler { @Override void newValueEvent() { newEvent(DesiredRateEvent.Type.VALUE); } PassiveScanDecoupler(ScheduledExecutorService scannerExecutor,
            Duration maxDuration, DesiredRateEventListener listener);   }