@Test public void testBasicStuff_2() { val history = new HashHistoryHolder<String>(2048); val iterations = 1000000; val timeStart = System.nanoTime(); for (int e = 0; e < iterations; e++) { assertFalse(history.storeIfUnknownMessageId(String.valueOf(e))); } val timeStop= System.nanoTime(); log.info("Average time per iteration: [{} us]", (timeStop - timeStart) / iterations); }
@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);  }