Release locks in reverse order of acquisition
This commit is contained in:
parent
a6abb4fcdd
commit
01495172d2
|
@ -393,7 +393,7 @@ public class Cache<K, V> {
|
||||||
weight = 0;
|
weight = 0;
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
for (int i = 0; i < NUMBER_OF_SEGMENTS; i++) {
|
for (int i = NUMBER_OF_SEGMENTS - 1; i >= 0; i--) {
|
||||||
if (haveSegmentLock[i]) {
|
if (haveSegmentLock[i]) {
|
||||||
segments[i].segmentLock.writeLock().unlock();
|
segments[i].segmentLock.writeLock().unlock();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue