Removed some debugging code, removed instance of double locking.

This commit is contained in:
Harrison Deng 2020-04-30 14:51:14 -05:00
parent 387393632d
commit 50ee956ce7

View File

@ -22,7 +22,6 @@ class CacheUsageStack<K, V> {
}
private void removeValueFromStack(CacheValue<K, V> value) {
if (value == null) throw new IllegalStateException("Current size is supposed to be " + size);
if (value.front != null) {
value.front.back = value.back;
} else {
@ -55,7 +54,10 @@ class CacheUsageStack<K, V> {
success = lock.tryLock();
if (success) {
try {
moveToTop(value);
if (!value.detached) {
removeValueFromStack(value);
addValueToStackTop(value);
}
} finally {
lock.unlock();
}