mirror of https://github.com/apache/lucene.git
SOLR-1727 SolrEventListener should extend NamedListInitializedPlugin
git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@906923 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
72638ac32a
commit
351e18206e
|
@ -227,7 +227,9 @@ Other Changes
|
|||
|
||||
* SOLR-1696 : Deprecate old <highlighting> syntax and move configuration to HighlightComponent (noble)
|
||||
|
||||
* Upgraded to Lucene 2.9-dev r900226 (koji)
|
||||
* Upgraded to Lucene 2.9-dev r900226 (koji)\
|
||||
|
||||
* SOLR-1727: SolrEventListener should extend NamedListInitializedPlugin (noble)
|
||||
|
||||
Build
|
||||
----------------------
|
||||
|
|
|
@ -273,12 +273,8 @@ public final class SolrCore implements SolrInfoMBean {
|
|||
}
|
||||
|
||||
private void initListeners() {
|
||||
List<PluginInfo> l = solrConfig.getPluginInfos(SolrEventListener.class.getName());
|
||||
firstSearcherListeners = new ArrayList<SolrEventListener>();
|
||||
newSearcherListeners = new ArrayList<SolrEventListener>();
|
||||
for (PluginInfo info : l) {
|
||||
SolrEventListener listener = createEventListener(info.className);
|
||||
listener.init(info.initArgs);
|
||||
for (PluginInfo info : solrConfig.getPluginInfos(SolrEventListener.class.getName())) {
|
||||
SolrEventListener listener = createInitInstance(info, SolrEventListener.class,"Event Listener",null);
|
||||
String event = info.attributes.get("event");
|
||||
if("firstSearcher".equals(event) ){
|
||||
firstSearcherListeners.add(listener);
|
||||
|
@ -289,8 +285,8 @@ public final class SolrCore implements SolrInfoMBean {
|
|||
}
|
||||
}
|
||||
|
||||
List<SolrEventListener> firstSearcherListeners;
|
||||
List<SolrEventListener> newSearcherListeners;
|
||||
final List<SolrEventListener> firstSearcherListeners = new ArrayList<SolrEventListener>();
|
||||
final List<SolrEventListener> newSearcherListeners = new ArrayList<SolrEventListener>();
|
||||
|
||||
/**
|
||||
* NOTE: this function is not thread safe. However, it is safe to call within the
|
||||
|
|
|
@ -19,6 +19,7 @@ package org.apache.solr.core;
|
|||
|
||||
import org.apache.solr.common.util.NamedList;
|
||||
import org.apache.solr.search.SolrIndexSearcher;
|
||||
import org.apache.solr.util.plugin.NamedListInitializedPlugin;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -26,10 +27,9 @@ import org.slf4j.LoggerFactory;
|
|||
/**
|
||||
* @version $Id$
|
||||
*/
|
||||
public interface SolrEventListener {
|
||||
public interface SolrEventListener extends NamedListInitializedPlugin{
|
||||
static final Logger log = LoggerFactory.getLogger(SolrCore.class);
|
||||
|
||||
public void init(NamedList args);
|
||||
|
||||
public void postCommit();
|
||||
|
||||
|
@ -61,4 +61,4 @@ public interface SolrEventListener {
|
|||
*/
|
||||
public void newSearcher(SolrIndexSearcher newSearcher, SolrIndexSearcher currentSearcher);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -61,10 +61,9 @@ public abstract class UpdateHandler implements SolrInfoMBean {
|
|||
private void parseEventListeners() {
|
||||
for (PluginInfo pluginInfo : core.getSolrConfig().getPluginInfos(SolrEventListener.class.getName())) {
|
||||
String event = pluginInfo.attributes.get("event");
|
||||
SolrEventListener listener = core.createEventListener(pluginInfo.className);
|
||||
listener.init(pluginInfo.initArgs);
|
||||
SolrEventListener listener = core.createInitInstance(pluginInfo,SolrEventListener.class,"Event Listener",null);
|
||||
if ("postCommit".equals(event)) {
|
||||
commitCallbacks.add(listener);
|
||||
commitCallbacks.add(core.createInitInstance(pluginInfo,SolrEventListener.class,"Event Listener",null));
|
||||
log.info("added SolrEventListener for postCommit: " + listener);
|
||||
} else if ("postOptimize".equals(event)) {
|
||||
optimizeCallbacks.add(listener);
|
||||
|
|
Loading…
Reference in New Issue