Skip to content

Commit

Permalink
renamed method
Browse files Browse the repository at this point in the history
  • Loading branch information
jdereg committed Jun 22, 2024
1 parent 959f0ac commit 355fd81
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/main/java/com/cedarsoftware/util/LRUCache.java
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
package com.cedarsoftware.util;

import java.lang.ref.WeakReference;
import java.util.AbstractMap;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;

/**
Expand Down Expand Up @@ -68,7 +65,7 @@ public LRUCache(int capacity) {
this.cache = new ConcurrentHashMap<>(capacity);
}

private void dynamicCleanup() {
private void cleanup() {
int size = cache.size();
if (size > capacity) {
List<Node<K, V>> nodes = new ArrayList<>(cache.values());
Expand Down Expand Up @@ -203,7 +200,7 @@ public String toString() {
private synchronized void scheduleCleanup() {
if (cache.size() > capacity && !cleanupScheduled) {
cleanupScheduled = true;
executorService.schedule(this::dynamicCleanup, DELAY, TimeUnit.MILLISECONDS);
executorService.schedule(this::cleanup, DELAY, TimeUnit.MILLISECONDS);
}
}
}

0 comments on commit 355fd81

Please sign in to comment.