From 3d1ce65a6e0c466bfd0c2c8dd4978a730ec4cf1a Mon Sep 17 00:00:00 2001 From: Ryan McKinley Date: Mon, 7 Jul 2008 20:19:37 +0000 Subject: [PATCH] SOLR-605 -- adding thread safety comment git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@674619 13f79535-47bb-0310-9956-ffa450edef68 --- src/java/org/apache/solr/core/SolrCore.java | 22 +++++++++++++++++++ .../org/apache/solr/update/UpdateHandler.java | 14 ++++++++++++ 2 files changed, 36 insertions(+) diff --git a/src/java/org/apache/solr/core/SolrCore.java b/src/java/org/apache/solr/core/SolrCore.java index 903366ecb1d..0f3eadb9da4 100644 --- a/src/java/org/apache/solr/core/SolrCore.java +++ b/src/java/org/apache/solr/core/SolrCore.java @@ -44,6 +44,7 @@ import org.apache.solr.update.processor.UpdateRequestProcessorFactory; import org.apache.solr.util.RefCounted; import org.apache.solr.util.plugin.AbstractPluginLoader; import org.apache.solr.util.plugin.NamedListPluginLoader; +import org.apache.solr.util.plugin.SolrCoreAware; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.xml.sax.SAXException; @@ -207,16 +208,37 @@ public final class SolrCore { newSearcherListeners = parseListener("//listener[@event=\"newSearcher\"]"); } + /** + * NOTE: this function is not thread safe. However, it is safe to call within the + * inform( SolrCore core ) function for SolrCoreAware classes. + * Outside inform, this could potentially throw a ConcurrentModificationException + * + * @see SolrCoreAware + */ public void registerFirstSearcherListener( SolrEventListener listener ) { firstSearcherListeners.add( listener ); } + /** + * NOTE: this function is not thread safe. However, it is safe to call within the + * inform( SolrCore core ) function for SolrCoreAware classes. + * Outside inform, this could potentially throw a ConcurrentModificationException + * + * @see SolrCoreAware + */ public void registerNewSearcherListener( SolrEventListener listener ) { newSearcherListeners.add( listener ); } + /** + * NOTE: this function is not thread safe. However, it is safe to call within the + * inform( SolrCore core ) function for SolrCoreAware classes. + * Outside inform, this could potentially throw a ConcurrentModificationException + * + * @see SolrCoreAware + */ public void registerResponseWriter( String name, QueryResponseWriter responseWriter ){ responseWriters.put(name, responseWriter); } diff --git a/src/java/org/apache/solr/update/UpdateHandler.java b/src/java/org/apache/solr/update/UpdateHandler.java index e84daf14924..9b4f8acd42d 100644 --- a/src/java/org/apache/solr/update/UpdateHandler.java +++ b/src/java/org/apache/solr/update/UpdateHandler.java @@ -179,11 +179,25 @@ public abstract class UpdateHandler implements SolrInfoMBean { } + /** + * NOTE: this function is not thread safe. However, it is safe to call within the + * inform( SolrCore core ) function for SolrCoreAware classes. + * Outside inform, this could potentially throw a ConcurrentModificationException + * + * @see SolrCoreAware + */ public void registerCommitCallback( SolrEventListener listener ) { commitCallbacks.add( listener ); } + /** + * NOTE: this function is not thread safe. However, it is safe to call within the + * inform( SolrCore core ) function for SolrCoreAware classes. + * Outside inform, this could potentially throw a ConcurrentModificationException + * + * @see SolrCoreAware + */ public void registerOptimizeCallback( SolrEventListener listener ) { optimizeCallbacks.add( listener );