@Test public void testBasicStuff_1() { val history = new HashHistoryHolder<String>(1024); val first = java.util.UUID.randomUUID().toString(); assertFalse(history.storeIfUnknownMessageId(first)); assertTrue(history.storeIfUnknownMessageId(first)); for (int e = 0; e < 1000; e++) { assertFalse(history.storeIfUnknownMessageId(String.valueOf(e))); } assertTrue(history.storeIfUnknownMessageId(first)); }
@Override public synchronized boolean storeIfUnknownMessageId(T id) { if (!isKnownMessageId(id)) { set.add(id); return false; } else return true; }
HashHistoryHolder implements MessagesHistoryHolder<T> { @Override public synchronized boolean storeIfUnknownMessageId(T id) { if (!isKnownMessageId(id)) { set.add(id); return false; } else return true; } }
HashHistoryHolder implements MessagesHistoryHolder<T> { @Override public synchronized boolean storeIfUnknownMessageId(T id) { if (!isKnownMessageId(id)) { set.add(id); return false; } else return true; } HashHistoryHolder(final int tailLength); }
HashHistoryHolder implements MessagesHistoryHolder<T> { @Override public synchronized boolean storeIfUnknownMessageId(T id) { if (!isKnownMessageId(id)) { set.add(id); return false; } else return true; } HashHistoryHolder(final int tailLength); @Override synchronized boolean storeIfUnknownMessageId(T id); @Override synchronized boolean isKnownMessageId(T id); }
HashHistoryHolder implements MessagesHistoryHolder<T> { @Override public synchronized boolean storeIfUnknownMessageId(T id) { if (!isKnownMessageId(id)) { set.add(id); return false; } else return true; } HashHistoryHolder(final int tailLength); @Override synchronized boolean storeIfUnknownMessageId(T id); @Override synchronized boolean isKnownMessageId(T id);  }