noblepaul commented on a change in pull request #1666:
URL: https://github.com/apache/lucene-solr/pull/1666#discussion_r453295158



##########
File path: solr/core/src/java/org/apache/solr/core/SolrCore.java
##########
@@ -626,25 +615,26 @@ public void deleteNonSnapshotIndexFiles(String 
indexDirPath) throws IOException
   }
 
 
+  @SuppressWarnings("unchecked")
   private void initListeners() {
     final Class<SolrEventListener> clazz = SolrEventListener.class;
     final String label = "Event Listener";
     for (PluginInfo info : 
solrConfig.getPluginInfos(SolrEventListener.class.getName())) {
       final String event = info.attributes.get("event");
       if ("firstSearcher".equals(event)) {
-        SolrEventListener obj = createInitInstance(info, clazz, label, null);
+        PluginHolder<SolrEventListener> obj = 
(PluginHolder<SolrEventListener>)PackagePluginHolder.createHolder(info, this, 
SolrEventListener.class, label);
         firstSearcherListeners.add(obj);
-        log.debug("[{}] Added SolrEventListener for firstSearcher: [{}]", 
logid, obj);
+        log.debug("[{}] Added SolrEventListener for firstSearcher: [{}]", 
logid, obj.get());
       } else if ("newSearcher".equals(event)) {
-        SolrEventListener obj = createInitInstance(info, clazz, label, null);
+        PluginHolder<SolrEventListener> obj = 
(PluginHolder<SolrEventListener>)PackagePluginHolder.createHolder(info, this, 
SolrEventListener.class, label);
         newSearcherListeners.add(obj);
-        log.debug("[{}] Added SolrEventListener for newSearcher: [{}]", logid, 
obj);
+        log.debug("[{}] Added SolrEventListener for newSearcher: [{}]", logid, 
obj.get());
       }
     }
   }
 
-  final List<SolrEventListener> firstSearcherListeners = new ArrayList<>();
-  final List<SolrEventListener> newSearcherListeners = new ArrayList<>();
+  final List<PluginHolder<SolrEventListener>> firstSearcherListeners = new 
ArrayList<>();

Review comment:
       It's possible. But the problem is event listeners have no names. 
`PluginBag` tracks plugins registered with a name 




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org

Reply via email to