From 0663ae3c99e8e0c920d67c7d5419fb7fa8ca99d7 Mon Sep 17 00:00:00 2001 From: sgaebel Date: Tue, 1 Dec 2020 22:34:30 +0100 Subject: [PATCH] adds synchornized dumplog --- source/net/yacy/search/query/AccessTracker.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/source/net/yacy/search/query/AccessTracker.java b/source/net/yacy/search/query/AccessTracker.java index d4ec3ba27..df327fd26 100644 --- a/source/net/yacy/search/query/AccessTracker.java +++ b/source/net/yacy/search/query/AccessTracker.java @@ -191,12 +191,16 @@ public class AccessTracker { public static void dumpLog() { lastLogDump = System.currentTimeMillis(); localCount += localSearches.size(); - while (!localSearches.isEmpty()) { - addToDump(localSearches.removeFirst(), 0); - } + synchronized (localSearches) { + while (!localSearches.isEmpty()) { + addToDump(localSearches.removeFirst(), 0); + } + } remoteCount += remoteSearches.size(); - while (!remoteSearches.isEmpty()) { - addToDump(remoteSearches.removeFirst(), 0); + synchronized (remoteSearches) { + while (!remoteSearches.isEmpty()) { + addToDump(remoteSearches.removeFirst(), 0); + } } Thread t = new Thread("AccessTracker.dumpLog") { @Override