dsmiley commented on a change in pull request #1124: SOLR-14151 :Schema components to be loadable from packages URL: https://github.com/apache/lucene-solr/pull/1124#discussion_r361579553
########## File path: solr/core/src/java/org/apache/solr/pkg/PackageListeners.java ########## @@ -75,15 +78,32 @@ synchronized void packagesUpdated(List<PackageLoader.Package> pkgs) { } private synchronized void invokeListeners(PackageLoader.Package pkg) { - for (Reference<Listener> ref : listeners) { - Listener listener = ref.get(); - if(listener == null) continue; - if (listener.packageName() == null || listener.packageName().equals(pkg.name())) { - listener.changed(pkg); + Ctx ctx = new Ctx(); + + try { + for (Reference<Listener> ref : listeners) { + Listener listener = ref.get(); + if(listener == null) continue; + if (listener.packageName() == null || listener.packageName().equals(pkg.name())) { + listener.changed(pkg, ctx); + } + } + } finally { + if(ctx.postProcessors != null){ + for (Runnable value : ctx.postProcessors.values()) { + value.run(); + } } } } + public void forEachListener(Consumer<Listener> listenerConsumer){ + listeners.forEach(ref -> { Review comment: Consider this instead: ```listeners.stream().map(Reference::get).filter(Objects::nonNull).forEach(listenerConsumer);``` ---------------------------------------------------------------- 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 With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org