Removed some debugging code, removed instance of double locking.
This commit is contained in:
parent
387393632d
commit
50ee956ce7
@ -22,7 +22,6 @@ class CacheUsageStack<K, V> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void removeValueFromStack(CacheValue<K, V> value) {
|
private void removeValueFromStack(CacheValue<K, V> value) {
|
||||||
if (value == null) throw new IllegalStateException("Current size is supposed to be " + size);
|
|
||||||
if (value.front != null) {
|
if (value.front != null) {
|
||||||
value.front.back = value.back;
|
value.front.back = value.back;
|
||||||
} else {
|
} else {
|
||||||
@ -55,7 +54,10 @@ class CacheUsageStack<K, V> {
|
|||||||
success = lock.tryLock();
|
success = lock.tryLock();
|
||||||
if (success) {
|
if (success) {
|
||||||
try {
|
try {
|
||||||
moveToTop(value);
|
if (!value.detached) {
|
||||||
|
removeValueFromStack(value);
|
||||||
|
addValueToStackTop(value);
|
||||||
|
}
|
||||||
} finally {
|
} finally {
|
||||||
lock.unlock();
|
lock.unlock();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user