@Override public Object answer(InvocationOnMock invocation) throws Exception { timerService.registerProcessingTimeTimer("ciao", 30); return null; } }).when(mockTriggerable).onProcessingTime(anyInternalTimer());
@Override public Object answer(InvocationOnMock invocation) throws Exception { timerService.registerProcessingTimeTimer("ciao", 20); return null; } }).when(mockTriggerable).onProcessingTime(anyInternalTimer());
timerService.registerProcessingTimeTimer("ciao", 10); timerService.registerProcessingTimeTimer("hello", 10); timerService.registerProcessingTimeTimer("ciao", 10); timerService.registerProcessingTimeTimer("hello", 10);
timerService.registerProcessingTimeTimer("ciao", 10); timerService.registerProcessingTimeTimer("hello", 10); timerService.registerProcessingTimeTimer("ciao", 10); timerService.registerProcessingTimeTimer("hello", 10);
/** * Verify that registering a processing-time timer that is earlier than the existing timers * removes the one physical timer and creates one for the earlier timestamp * {@link ProcessingTimeService}. */ @Test public void testRegisterEarlierProcessingTimerMovesPhysicalProcessingTimer() throws Exception { @SuppressWarnings("unchecked") Triggerable<Integer, String> mockTriggerable = mock(Triggerable.class); TestKeyContext keyContext = new TestKeyContext(); TestProcessingTimeService processingTimeService = new TestProcessingTimeService(); InternalTimerServiceImpl<Integer, String> timerService = createAndStartInternalTimerService(mockTriggerable, keyContext, processingTimeService, testKeyGroupRange, createQueueFactory()); int key = getKeyInKeyGroupRange(testKeyGroupRange, maxParallelism); keyContext.setCurrentKey(key); timerService.registerProcessingTimeTimer("ciao", 20); assertEquals(1, timerService.numProcessingTimeTimers()); assertEquals(1, processingTimeService.getNumActiveTimers()); assertThat(processingTimeService.getActiveTimerTimestamps(), containsInAnyOrder(20L)); timerService.registerProcessingTimeTimer("ciao", 10); assertEquals(2, timerService.numProcessingTimeTimers()); assertEquals(1, processingTimeService.getNumActiveTimers()); assertThat(processingTimeService.getActiveTimerTimestamps(), containsInAnyOrder(10L)); }
timerService.registerProcessingTimeTimer("ciao", 10); timerService.registerEventTimeTimer("hello", 10); timerService.registerProcessingTimeTimer("hello", 10);
timerService.registerProcessingTimeTimer("ciao", 10); timerService.registerEventTimeTimer("hello", 10); timerService.registerProcessingTimeTimer("hello", 10);
keyContext.setCurrentKey(key); timerService.registerProcessingTimeTimer("ciao", 10); timerService.registerProcessingTimeTimer("ciao", 20); timerService.registerProcessingTimeTimer("ciao", 30); timerService.registerProcessingTimeTimer("hello", 10); timerService.registerProcessingTimeTimer("hello", 20); timerService.registerProcessingTimeTimer("ciao", 40);
timerService.registerProcessingTimeTimer(timer.getNamespace(), timer.getTimestamp());
timerService.registerProcessingTimeTimer("ciao", 10);