Skip to content

Commit

Permalink
Only optional extended plugins
Browse files Browse the repository at this point in the history
Signed-off-by: Craig Perkins <[email protected]>
  • Loading branch information
cwperks committed Dec 24, 2024
1 parent 13c7bee commit 29ff5b0
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 71 deletions.

This file was deleted.

This file was deleted.

13 changes: 2 additions & 11 deletions server/src/main/java/org/opensearch/plugins/PluginsService.java
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ public PluginsService(
"1.8",
pluginClass.getName(),
null,
classpathPlugins.stream().map(Class::getName).filter(cp -> !pluginClass.getName().equals(cp)).collect(Collectors.toList()),
Collections.emptyList(),
false
);
if (logger.isTraceEnabled()) {
Expand All @@ -160,7 +160,6 @@ public PluginsService(
pluginsList.add(pluginInfo);
pluginsNames.add(pluginInfo.getName());
}
loadExtensions(pluginsLoaded);

Set<Bundle> seenBundles = new LinkedHashSet<>();
List<PluginInfo> modulesList = new ArrayList<>();
Expand Down Expand Up @@ -571,17 +570,9 @@ private static void loadExtensionsForPlugin(ExtensiblePlugin extensiblePlugin, L
ExtensiblePlugin.ExtensionLoader extensionLoader = new ExtensiblePlugin.ExtensionLoader() {
@Override
public <T> List<T> loadExtensions(Class<T> extensionPointType) {
Set<Class<?>> seenClasses = new LinkedHashSet<>();
List<T> result = new ArrayList<>();

for (Plugin extendingPlugin : extendingPlugins) {
List<? extends T> extensions = createExtensions(extensionPointType, extendingPlugin);
for (T extension : extensions) {
// Only add if we haven't seen this class before, needed for classpath extensions for testing
if (seenClasses.add(extension.getClass())) {
result.add(extension);
}
}
result.addAll(createExtensions(extensionPointType, extendingPlugin));
}
return Collections.unmodifiableList(result);
}
Expand Down

0 comments on commit 29ff5b0

Please sign in to comment.