mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-15 17:35:41 +00:00
Preserve copy of head after taking lock on LRU list
This commit is contained in:
parent
e0fa3297bd
commit
818d217ede
@ -367,9 +367,10 @@ public class Cache<K, V> {
|
||||
* {@link org.elasticsearch.common.cache.RemovalNotification.RemovalReason} INVALIDATED.
|
||||
*/
|
||||
public void invalidateAll() {
|
||||
Entry<K, V> h = head;
|
||||
Entry<K, V> h;
|
||||
Arrays.stream(segments).forEach(segment -> segment.segmentLock.writeLock().lock());
|
||||
try (ReleasableLock ignored = lruLock.acquire()) {
|
||||
h = head;
|
||||
Arrays.stream(segments).forEach(segment -> segment.map = new HashMap<>());
|
||||
Entry<K, V> current = head;
|
||||
while (current != null) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user