tflobbe commented on a change in pull request #1804:
URL: https://github.com/apache/lucene-solr/pull/1804#discussion_r480308790



##########
File path: solr/core/src/java/org/apache/solr/schema/IndexSchema.java
##########
@@ -190,10 +197,41 @@ public IndexSchema(String name, InputSource is, Version 
luceneVersion, SolrResou
   protected IndexSchema(Version luceneVersion, SolrResourceLoader loader, 
Properties substitutableProperties) {
     this.luceneVersion = Objects.requireNonNull(luceneVersion);
     this.loader = loader;
-    this.solrClassLoader = loader;//loader.getCore() == null? loader: 
loader.getCore().getSchemaPluginsLoader();
+    this.solrClassLoader = createClassLoader(loader);
     this.substitutableProperties = substitutableProperties;
   }
 
+  private SolrClassLoader createClassLoader(SolrResourceLoader loader) {
+    if(loader.getCoreContainer() != null && loader.getSolrConfig() != null){
+      return new PackageListeningClassLoader(loader.getCoreContainer(), loader,
+          pkg -> loader.getSolrConfig().maxPackageVersion(pkg),
+          () -> reloadCoreSchema());
+    }
+    return loader;
+  }
+
+  private void reloadCoreSchema() {
+    if(coreContainer != null) {
+     cores.forEach((coreName, id) -> {
+       try(SolrCore core = coreContainer.getCore(coreName, id)){
+         if(core != null) {
+           core.fetchLatestSchema();
+         }
+       }
+     });
+    }
+  }

Review comment:
       Each IndexSchema object gets a `PackageListeningClassLoader` with a 
listener that, on change, triggers a reload of the schema in all cores? 




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