Release locks in reverse order of acquisition

This commit is contained in:
Jason Tedor 2015-10-09 11:10:52 -04:00
parent a6abb4fcdd
commit 01495172d2
1 changed files with 1 additions and 1 deletions

View File

@ -393,7 +393,7 @@ public class Cache<K, V> {
weight = 0;
}
} finally {
for (int i = 0; i < NUMBER_OF_SEGMENTS; i++) {
for (int i = NUMBER_OF_SEGMENTS - 1; i >= 0; i--) {
if (haveSegmentLock[i]) {
segments[i].segmentLock.writeLock().unlock();
}