ExpiryMarker extends Expirable implements Serializable { @Override public boolean isReplaceableBy(long txTimestamp, Object newVersion, Comparator versionComparator) { if (txTimestamp > timeout) { return true; } if (multiplicity > 0) { return false; } if (version == null) { return expiredTimestamp != NOT_COMPLETELY_EXPIRED && txTimestamp > expiredTimestamp; } return versionComparator.compare(version, newVersion) < 0; } ExpiryMarker();  ExpiryMarker(Object version, long timeout, String markerId); private  ExpiryMarker(Object version, boolean concurrent, long expiredTimestamp, String markerId, int multiplicity,
                         long timeout); @Override boolean isReplaceableBy(long txTimestamp, Object newVersion, Comparator versionComparator); @Override Object getValue(); @Override Object getValue(long txTimestamp); @Override boolean matches(ExpiryMarker lock); boolean isConcurrent(); @Override ExpiryMarker markForExpiration(long timeout, String nextMarkerId); ExpiryMarker expire(long timestamp); @Override void writeData(ObjectDataOutput out); @Override void readData(ObjectDataInput in); @Override int getFactoryId(); @Override int getId(); long getTimeout();  }
@Test public void testIsReplaceableByTimestampBeforeTimeout() throws Exception { ExpiryMarker marker = new ExpiryMarker(null, 100L, "the-marker-id"); assertFalse("marker is not replaceable when it hasn't timed out", marker.isReplaceableBy(99L, null, null)); }
@Test public void testIsReplaceableByTimestampEqualTimeout() throws Exception { ExpiryMarker marker = new ExpiryMarker(null, 100L, "the-marker-id"); assertFalse("marker is not replaceable when it hasn't timed out", marker.isReplaceableBy(100L, null, null)); }
@Test public void testIsReplaceableByTimestampAfterTimeout() throws Exception { ExpiryMarker marker = new ExpiryMarker(null, 100L, "the-marker-id"); assertTrue("marker is replaceable when it has timed out", marker.isReplaceableBy(101L, null, null)); }