@Test public void shouldUpdateTimestampAfterPreInvalidationMessage_issue_33() { long firstTimestamp = 1; long secondTimestamp = 2; long preInvalidationPublishTime = 3; long thirdTimestamp = 4; long invalidationPublishTime = 5; long afterUpdateReadTime = 6; when(cluster.getClusterTime()).thenReturn(firstTimestamp, secondTimestamp, thirdTimestamp); assertThat(target.put("Entity", firstTimestamp, firstTimestamp, null), is(true)); assertThat("primed value should be in the cache", (Long) target.get("Entity", firstTimestamp), is(firstTimestamp)); long invalidationOffset = 100L; UUID regionUuid = UUID.randomUUID(); Message<Object> preInvalidate = new Message<Object>("topicName", new Timestamp("Entity", secondTimestamp + invalidationOffset, regionUuid), preInvalidationPublishTime, member); listener.onMessage(preInvalidate); assertTrue("Timestamp cache must be updated by preInvalidation.", (Long) target.get("Entity", afterUpdateReadTime) == secondTimestamp); Message<Object> invalidate = new Message<Object>("topicName", new Timestamp("Entity", thirdTimestamp, regionUuid), invalidationPublishTime, member); listener.onMessage(invalidate); assertTrue("Timestamp cache must be updated after preInvalidation", (Long) target.get("Entity", afterUpdateReadTime) < invalidationOffset); }
@Override public boolean put(final Object key, final Object value, final long txTimestamp, final Object version) { boolean succeed = super.put(key, value, txTimestamp, version); if (succeed) { maybeNotifyTopic(key, value, version); } return succeed; }
TimestampsRegionCache extends LocalRegionCache implements RegionCache { @Override public boolean put(final Object key, final Object value, final long txTimestamp, final Object version) { boolean succeed = super.put(key, value, txTimestamp, version); if (succeed) { maybeNotifyTopic(key, value, version); } return succeed; } }
TimestampsRegionCache extends LocalRegionCache implements RegionCache { @Override public boolean put(final Object key, final Object value, final long txTimestamp, final Object version) { boolean succeed = super.put(key, value, txTimestamp, version); if (succeed) { maybeNotifyTopic(key, value, version); } return succeed; } TimestampsRegionCache(final String name, final HazelcastInstance hazelcastInstance); }
TimestampsRegionCache extends LocalRegionCache implements RegionCache { @Override public boolean put(final Object key, final Object value, final long txTimestamp, final Object version) { boolean succeed = super.put(key, value, txTimestamp, version); if (succeed) { maybeNotifyTopic(key, value, version); } return succeed; } TimestampsRegionCache(final String name, final HazelcastInstance hazelcastInstance); @Override boolean put(final Object key, final Object value, final long txTimestamp, final Object version); @Override void clear(); }
TimestampsRegionCache extends LocalRegionCache implements RegionCache { @Override public boolean put(final Object key, final Object value, final long txTimestamp, final Object version) { boolean succeed = super.put(key, value, txTimestamp, version); if (succeed) { maybeNotifyTopic(key, value, version); } return succeed; } TimestampsRegionCache(final String name, final HazelcastInstance hazelcastInstance); @Override boolean put(final Object key, final Object value, final long txTimestamp, final Object version); @Override void clear();  }