private void evict() { Node victim = null; for (Node head : headQ) { if (head.next != head) { victim = head.next; break; } } if (victim == null) { return; } victim.remove(); data.remove(victim.key); out.put(victim.key, victim); if (out.size() > maxOut) { out.remove(out.firstLongKey()); } }
@Override public long firstLongKey() { return sortedMap.firstLongKey(); } @Override
@Override public long firstLongKey() { synchronized (sync) { return sortedMap.firstLongKey(); } } @Override
/** * {@inheritDoc} * * @deprecated Please use the corresponding type-specific method instead. */ @Deprecated @Override default Long firstKey() { return Long.valueOf(firstLongKey()); } /**
public void removeExcess() { int currentSize = keyToValue.size(); while (currentSize > flushedSize) { long firstKey = timeStampToKey.firstLongKey(); Set<KEY> keys = timeStampToKey.get(firstKey); Iterator<KEY> keyIterator = keys.iterator(); while (keyIterator.hasNext() && currentSize > flushedSize) { KEY key = keyIterator.next(); VALUE value = keyToValue.remove(key); if (value == null) { continue; } currentSize--; changed.remove(key); keyToTimeStamp.remove(key); flushListener.flush(key, value); } if (keys.isEmpty()) { timeStampToKey.remove(firstKey); } } }
private void evict() { Node victim = null; for (Node head : headQ) { if (head.next != head) { victim = head.next; break; } } if (victim == null) { return; } victim.remove(); data.remove(victim.key); out.put(victim.key, victim); if (out.size() > maxOut) { out.remove(out.firstLongKey()); } }