@Test public void testProcessWithDifferentMarker() throws Exception { Map.Entry<Object, Expirable> entry = mockEntry(new ExpiryMarker(null, 100L, "the-marker-id")); UnlockEntryProcessor processor = new UnlockEntryProcessor(new ExpiryMarker(null, 100L, "other-marker-id"), "next-marker-id", 100L); processor.process(entry); verify(entry, never()).setValue(any(Expirable.class)); }
@Override public Object process(final Map.Entry<Object, Expirable> entry) { Expirable expirable = entry.getValue(); if (expirable != null) { if (expirable.matches(lock)) { expirable = ((ExpiryMarker) expirable).expire(timestamp); } else if (expirable.getValue() != null) { expirable = new ExpiryMarker(null, timestamp, nextMarkerId).expire(timestamp); } else { return null; } entry.setValue(expirable); } return null; }
UnlockEntryProcessor implements EntryProcessor<Object, Expirable, Object>, IdentifiedDataSerializable { @Override public Object process(final Map.Entry<Object, Expirable> entry) { Expirable expirable = entry.getValue(); if (expirable != null) { if (expirable.matches(lock)) { expirable = ((ExpiryMarker) expirable).expire(timestamp); } else if (expirable.getValue() != null) { expirable = new ExpiryMarker(null, timestamp, nextMarkerId).expire(timestamp); } else { return null; } entry.setValue(expirable); } return null; } }
UnlockEntryProcessor implements EntryProcessor<Object, Expirable, Object>, IdentifiedDataSerializable { @Override public Object process(final Map.Entry<Object, Expirable> entry) { Expirable expirable = entry.getValue(); if (expirable != null) { if (expirable.matches(lock)) { expirable = ((ExpiryMarker) expirable).expire(timestamp); } else if (expirable.getValue() != null) { expirable = new ExpiryMarker(null, timestamp, nextMarkerId).expire(timestamp); } else { return null; } entry.setValue(expirable); } return null; } UnlockEntryProcessor();  UnlockEntryProcessor(final ExpiryMarker lock, final String nextMarkerId, final long timestamp); }
UnlockEntryProcessor implements EntryProcessor<Object, Expirable, Object>, IdentifiedDataSerializable { @Override public Object process(final Map.Entry<Object, Expirable> entry) { Expirable expirable = entry.getValue(); if (expirable != null) { if (expirable.matches(lock)) { expirable = ((ExpiryMarker) expirable).expire(timestamp); } else if (expirable.getValue() != null) { expirable = new ExpiryMarker(null, timestamp, nextMarkerId).expire(timestamp); } else { return null; } entry.setValue(expirable); } return null; } UnlockEntryProcessor();  UnlockEntryProcessor(final ExpiryMarker lock, final String nextMarkerId, final long timestamp); @Override Object process(final Map.Entry<Object, Expirable> entry); @Override void writeData(final ObjectDataOutput out); @Override void readData(final ObjectDataInput in); @Override int getClassId(); @Override int getFactoryId(); }
UnlockEntryProcessor implements EntryProcessor<Object, Expirable, Object>, IdentifiedDataSerializable { @Override public Object process(final Map.Entry<Object, Expirable> entry) { Expirable expirable = entry.getValue(); if (expirable != null) { if (expirable.matches(lock)) { expirable = ((ExpiryMarker) expirable).expire(timestamp); } else if (expirable.getValue() != null) { expirable = new ExpiryMarker(null, timestamp, nextMarkerId).expire(timestamp); } else { return null; } entry.setValue(expirable); } return null; } UnlockEntryProcessor();  UnlockEntryProcessor(final ExpiryMarker lock, final String nextMarkerId, final long timestamp); @Override Object process(final Map.Entry<Object, Expirable> entry); @Override void writeData(final ObjectDataOutput out); @Override void readData(final ObjectDataInput in); @Override int getClassId(); @Override int getFactoryId();  }