Skip to content

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

concurrency enhancement in ConfigurationSet

Michael Peter Christena6d60fc21f2c
diff --git a/source/net/yacy/cora/storage/ConfigurationSet.java b/source/net/yacy/cora/storage/ConfigurationSet.java
index de025bfea..bb0e84497 100644
--- a/source/net/yacy/cora/storage/ConfigurationSet.java
+++ b/source/net/yacy/cora/storage/ConfigurationSet.java
@@ -72,6 +72,21 @@ public class ConfigurationSet extends AbstractSet<String> implements Set<String>
}
}
+ /**
+ * override the abstract implementation because that is not stable in concurrent requests
+ */
+ @Override
+ public boolean contains(Object o) {
+ if (o == null || !(o instanceof String)) return false;
+ String s = (String) o;
+ synchronized (this) {
+ for (String line : this.lines) {
+ if (line != null && line.equals(s)) return true;
+ }
+ }
+ return false;
+ }
+
public boolean containsDisabled(final String o) {
if (o == null) return false;
final Iterator<Entry> i = new EntryIterator();