From a6d60fc21f2c8de2f1e7dba925b436fd441fba43 Mon Sep 17 00:00:00 2001 From: Michael Peter Christen Date: Fri, 27 Apr 2012 17:20:18 +0200 Subject: [PATCH] concurrency enhancement in ConfigurationSet --- .../net/yacy/cora/storage/ConfigurationSet.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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 implements Set } } + /** + * 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 i = new EntryIterator();