Skip to content
This repository has been archived by the owner on Sep 26, 2019. It is now read-only.

Commit

Permalink
x
Browse files Browse the repository at this point in the history
  • Loading branch information
smatthewenglish committed Apr 20, 2019
1 parent f114ed9 commit fcc06e6
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,15 +105,15 @@ public PendingTransactions(
timerUtil.setPeriodic(transactionEvictionIntervalMs, this::evictOldTransactions);
}

private boolean filterStream(TransactionInfo transaction) {
private boolean applyEvictionThreshold(final TransactionInfo transaction) {
final long now = System.currentTimeMillis();
return now - transaction.getAddedToPoolAt().getEpochSecond() > transactionEvictionIntervalMs;
}

private void evictOldTransactions() {
synchronized (pendingTransactions) {
final List<TransactionInfo> transactionsToRemove =
prioritizedTransactions.stream().filter(this::filterStream).collect(toList());
prioritizedTransactions.stream().filter(this::applyEvictionThreshold).collect(toList());
transactionsToRemove.forEach(transaction -> removeTransaction(transaction.getTransaction()));
}
}
Expand Down

0 comments on commit fcc06e6

Please sign in to comment.