sigram commented on a change in pull request #1758:
URL: https://github.com/apache/lucene-solr/pull/1758#discussion_r494131970



##########
File path: solr/core/src/java/org/apache/solr/core/CoreContainer.java
##########
@@ -889,7 +896,37 @@ public void load() {
       ContainerPluginsApi containerPluginsApi = new ContainerPluginsApi(this);
       
containerHandlers.getApiBag().registerObject(containerPluginsApi.readAPI);
       
containerHandlers.getApiBag().registerObject(containerPluginsApi.editAPI);
+
+      // create the ClusterEventProducer
+      CustomContainerPlugins.ApiInfo clusterEventProducerInfo = 
customContainerPlugins.getPlugin(ClusterEventProducer.PLUGIN_NAME);
+      if (clusterEventProducerInfo != null) {
+        clusterEventProducer = (ClusterEventProducer) 
clusterEventProducerInfo.getInstance();
+      } else {
+        clusterEventProducer = new ClusterEventProducerImpl(this);
+      }
+      // init ClusterSingleton-s
+      Map<String, ClusterSingleton> singletons = new ConcurrentHashMap<>();
+      if (clusterEventProducer instanceof ClusterSingleton) {
+        singletons.put(ClusterEventProducer.PLUGIN_NAME, (ClusterSingleton) 
clusterEventProducer);
+      }
+
+      // register ClusterSingleton handlers
+      // XXX register also other ClusterSingleton-s from packages - how?
+      containerHandlers.keySet().forEach(handlerName -> {

Review comment:
       The purpose of this code is to build a registry of existing 
`ClusterSingleton` implementations (perhaps this should go to a dedicated 
registry class). We don't have a dependency injection framework, so we need to 
somewhere perform the discovery and registration ourselves.
   And we need a registry in order to manage the `ClusterSingleton` lifecycle 
together with the Overseer leader life-cycle.




----------------------------------------------------------------
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