/** * Notifies shared buffer that there will be no events with timestamp <&eq; the given value. It allows to clear * internal counters for number of events seen so far per timestamp. * * @param timestamp watermark, no earlier events will arrive * @throws Exception Thrown if the system cannot access the state. */ public void advanceTime(long timestamp) throws Exception { sharedBuffer.advanceTime(timestamp); }
@Test public void testSharedBufferCountersClearing() throws Exception { SharedBuffer<Event> sharedBuffer = TestSharedBuffer.createTestBuffer(Event.createTypeSerializer()); int numberEvents = 4; Event[] events = new Event[numberEvents]; for (int i = 0; i < numberEvents; i++) { events[i] = new Event(i + 1, "e" + (i + 1), i); sharedBuffer.registerEvent(events[i], i); } sharedBuffer.advanceTime(3); Iterator<Map.Entry<Long, Integer>> counters = sharedBuffer.getEventCounters(); Map.Entry<Long, Integer> entry = counters.next(); assertEquals(3, entry.getKey().longValue()); assertEquals(1, entry.getValue().intValue()); assertFalse(counters.hasNext()); }
/** * Notifies shared buffer that there will be no events with timestamp <&eq; the given value. It allows to clear * internal counters for number of events seen so far per timestamp. * * @param timestamp watermark, no earlier events will arrive * @throws Exception Thrown if the system cannot access the state. */ public void advanceTime(long timestamp) throws Exception { sharedBuffer.advanceTime(timestamp); }
/** * Notifies shared buffer that there will be no events with timestamp <&eq; the given value. It allows to clear * internal counters for number of events seen so far per timestamp. * * @param timestamp watermark, no earlier events will arrive * @throws Exception Thrown if the system cannot access the state. */ public void advanceTime(long timestamp) throws Exception { sharedBuffer.advanceTime(timestamp); }