Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

A concurrent access can happen on the blacklist (with latest introduced blacklist check in media snippet computation)

Roland Haeder319fd1f4aa7c
diff --git a/source/net/yacy/repository/Blacklist.java b/source/net/yacy/repository/Blacklist.java
index 97e8bcb0e..f8162b653 100644
--- a/source/net/yacy/repository/Blacklist.java
+++ b/source/net/yacy/repository/Blacklist.java
@@ -38,6 +38,8 @@ import java.util.Map.Entry;
import java.util.Set;
import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
import net.yacy.kelondro.data.meta.DigestURI;
import net.yacy.kelondro.data.meta.URIMetadataRow;
@@ -91,18 +93,18 @@ public class Blacklist {
}));
public static final String BLACKLIST_TYPES_STRING = "proxy,crawler,dht,search,surftips,news";
private File blacklistRootPath = null;
- private final Map<String, HandleSet> cachedUrlHashs;
- private final Map<String, Map<String, List<String>>> hostpaths_matchable; // key=host, value=path; mapped url is http://host/path; path does not start with '/' here
- private final Map<String, Map<String, List<String>>> hostpaths_notmatchable; // key=host, value=path; mapped url is http://host/path; path does not start with '/' here
+ private final ConcurrentMap<String, HandleSet> cachedUrlHashs;
+ private final ConcurrentMap<String, Map<String, List<String>>> hostpaths_matchable; // key=host, value=path; mapped url is http://host/path; path does not start with '/' here
+ private final ConcurrentMap<String, Map<String, List<String>>> hostpaths_notmatchable; // key=host, value=path; mapped url is http://host/path; path does not start with '/' here
public Blacklist(final File rootPath) {
setRootPath(rootPath);
// prepare the data structure
- this.hostpaths_matchable = new HashMap<String, Map<String, List<String>>>();
- this.hostpaths_notmatchable = new HashMap<String, Map<String, List<String>>>();
- this.cachedUrlHashs = new HashMap<String, HandleSet>();
+ this.hostpaths_matchable = new ConcurrentHashMap<String, Map<String, List<String>>>();
+ this.hostpaths_notmatchable = new ConcurrentHashMap<String, Map<String, List<String>>>();
+ this.cachedUrlHashs = new ConcurrentHashMap<String, HandleSet>();
for (final String blacklistType : BLACKLIST_TYPES) {
this.hostpaths_matchable.put(blacklistType, new HashMap<String, List<String>>());