Skip to content

Instantly share code, notes, and snippets.

@Aitozi
Created April 2, 2018 05:13
Show Gist options
  • Save Aitozi/007210bc7ade01a81f8d0fc4ba5a2c99 to your computer and use it in GitHub Desktop.
Save Aitozi/007210bc7ade01a81f8d0fc4ba5a2c99 to your computer and use it in GitHub Desktop.
这个清理为什么遇到比pruningTimestamp大的时间就停止清理了呢
public void prune(long pruningTimestamp, List<SharedBufferEntry<K, V>> prunedEntries) {
Iterator<Map.Entry<ValueTimeWrapper<V>, SharedBufferEntry<K, V>>> iterator = entries.entrySet().iterator();
boolean continuePruning = true;
while (iterator.hasNext() && continuePruning) {
SharedBufferEntry<K, V> entry = iterator.next().getValue();
if (entry.getValueTime().getTimestamp() <= pruningTimestamp) {
prunedEntries.add(entry);
iterator.remove();
} else {
continuePruning = false;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment