@Test public void reconcile() throws Exception { EntityMessage message = mock(EntityMessage.class); EntityResponse response = mock(EntityResponse.class); TrackerImpl<EntityMessage, EntityResponse> tracker = new TrackerImpl<>(); tracker.track(1L, 1L, message, response); tracker.track(2L, 2L, message, response); tracker.track(3L, 3L, message, response); assertThat(tracker.getTrackedValue(1L), notNullValue()); assertThat(tracker.getTrackedValue(2L), notNullValue()); assertThat(tracker.getTrackedValue(3L), notNullValue()); tracker.reconcile(1L); assertThat(tracker.getTrackedValue(1L), notNullValue()); assertThat(tracker.getTrackedValue(2L), notNullValue()); assertThat(tracker.getTrackedValue(3L), notNullValue()); tracker.reconcile(2L); assertThat(tracker.getTrackedValue(1L), nullValue()); assertThat(tracker.getTrackedValue(2L), notNullValue()); assertThat(tracker.getTrackedValue(3L), notNullValue()); tracker.reconcile(3L); assertThat(tracker.getTrackedValue(1L), nullValue()); assertThat(tracker.getTrackedValue(2L), nullValue()); assertThat(tracker.getTrackedValue(3L), notNullValue()); }
@Override public synchronized void reconcile(long id) { reconciledMarker = Math.max(id, reconciledMarker); trackedValues.headMap(id).clear(); }
TrackerImpl implements Tracker<M, R> { @Override public synchronized void reconcile(long id) { reconciledMarker = Math.max(id, reconciledMarker); trackedValues.headMap(id).clear(); } }
TrackerImpl implements Tracker<M, R> { @Override public synchronized void reconcile(long id) { reconciledMarker = Math.max(id, reconciledMarker); trackedValues.headMap(id).clear(); } @SuppressWarnings("unchecked")  TrackerImpl(); }
TrackerImpl implements Tracker<M, R> { @Override public synchronized void reconcile(long id) { reconciledMarker = Math.max(id, reconciledMarker); trackedValues.headMap(id).clear(); } @SuppressWarnings("unchecked")  TrackerImpl(); @Override void track(long track, long id, M source, R value); @Override synchronized R getTrackedValue(long id); @Override synchronized M getTrackedRequest(long id); @Override synchronized void reconcile(long id); @Override boolean wasReconciled(long id); @Override synchronized void addStateTo(StateDumpCollector stateDumper); }
TrackerImpl implements Tracker<M, R> { @Override public synchronized void reconcile(long id) { reconciledMarker = Math.max(id, reconciledMarker); trackedValues.headMap(id).clear(); } @SuppressWarnings("unchecked")  TrackerImpl(); @Override void track(long track, long id, M source, R value); @Override synchronized R getTrackedValue(long id); @Override synchronized M getTrackedRequest(long id); @Override synchronized void reconcile(long id); @Override boolean wasReconciled(long id); @Override synchronized void addStateTo(StateDumpCollector stateDumper);  }