mirror of
https://github.com/elastic/elasticsearch.git
synced 2025-06-28 09:28:55 -04:00
Remove plugin classloader indirection (#113154)
Extensible plugins use a custom classloader for other plugin jars. When extensible plugins were first added, the transport client still existed, and elasticsearch plugins did not exist in the transport client (at least not the ones that create classloaders). Yet the transport client still created a PluginsService. An indirection was used to avoid creating separate classloaders when the transport client had created the PluginsService. The transport client was removed in 8.0, but the indirection still exists. This commit removes that indirection layer.
This commit is contained in:
parent
b977a337e3
commit
2ecfb397ad
9 changed files with 3 additions and 68 deletions
|
@ -59,7 +59,6 @@ public class InternalDistributionModuleCheckTaskProvider {
|
|||
"org.elasticsearch.nativeaccess",
|
||||
"org.elasticsearch.plugin",
|
||||
"org.elasticsearch.plugin.analysis",
|
||||
"org.elasticsearch.pluginclassloader",
|
||||
"org.elasticsearch.securesm",
|
||||
"org.elasticsearch.server",
|
||||
"org.elasticsearch.simdvec",
|
||||
|
|
|
@ -1,18 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the "Elastic License
|
||||
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
|
||||
* Public License v 1"; you may not use this file except in compliance with, at
|
||||
* your election, the "Elastic License 2.0", the "GNU Affero General Public
|
||||
* License v3.0 only", or the "Server Side Public License, v 1".
|
||||
*/
|
||||
|
||||
// This is only required because :server needs this at runtime.
|
||||
// We'll be removing this in 8.0 so for now just publish the JAR to make dependency resolution work.
|
||||
apply plugin: 'elasticsearch.publish'
|
||||
|
||||
tasks.named("test").configure { enabled = false }
|
||||
|
||||
// test depend on ES core...
|
||||
tasks.named('forbiddenApisMain').configure { enabled = false}
|
||||
tasks.named("jarHell").configure { enabled = false }
|
|
@ -1,12 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the "Elastic License
|
||||
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
|
||||
* Public License v 1"; you may not use this file except in compliance with, at
|
||||
* your election, the "Elastic License 2.0", the "GNU Affero General Public
|
||||
* License v3.0 only", or the "Server Side Public License, v 1".
|
||||
*/
|
||||
|
||||
module org.elasticsearch.pluginclassloader {
|
||||
exports org.elasticsearch.plugins.loader;
|
||||
}
|
|
@ -40,8 +40,6 @@ dependencies {
|
|||
api project(":libs:elasticsearch-tdigest")
|
||||
implementation project(":libs:elasticsearch-simdvec")
|
||||
|
||||
implementation project(':libs:elasticsearch-plugin-classloader')
|
||||
|
||||
// lucene
|
||||
api "org.apache.lucene:lucene-core:${versions.lucene}"
|
||||
api "org.apache.lucene:lucene-analysis-common:${versions.lucene}"
|
||||
|
|
|
@ -25,7 +25,6 @@ module org.elasticsearch.server {
|
|||
requires org.elasticsearch.nativeaccess;
|
||||
requires org.elasticsearch.geo;
|
||||
requires org.elasticsearch.lz4;
|
||||
requires org.elasticsearch.pluginclassloader;
|
||||
requires org.elasticsearch.securesm;
|
||||
requires org.elasticsearch.xcontent;
|
||||
requires org.elasticsearch.logging;
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
* License v3.0 only", or the "Server Side Public License, v 1".
|
||||
*/
|
||||
|
||||
package org.elasticsearch.plugins.loader;
|
||||
package org.elasticsearch.plugins;
|
||||
|
||||
import java.security.AccessController;
|
||||
import java.security.PrivilegedAction;
|
||||
|
@ -17,7 +17,7 @@ import java.util.List;
|
|||
/**
|
||||
* A classloader that is a union over the parent core classloader and classloaders of extended plugins.
|
||||
*/
|
||||
public class ExtendedPluginsClassLoader extends ClassLoader {
|
||||
class ExtendedPluginsClassLoader extends ClassLoader {
|
||||
|
||||
/** Loaders of plugins extended by a plugin. */
|
||||
private final List<ClassLoader> extendedLoaders;
|
|
@ -1,26 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the "Elastic License
|
||||
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
|
||||
* Public License v 1"; you may not use this file except in compliance with, at
|
||||
* your election, the "Elastic License 2.0", the "GNU Affero General Public
|
||||
* License v3.0 only", or the "Server Side Public License, v 1".
|
||||
*/
|
||||
|
||||
package org.elasticsearch.plugins;
|
||||
|
||||
import org.elasticsearch.plugins.loader.ExtendedPluginsClassLoader;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
// TODO: remove this indirection now that transport client is gone
|
||||
/**
|
||||
* This class exists solely as an intermediate layer to avoid causing PluginsService
|
||||
* to load ExtendedPluginsClassLoader when used in the transport client.
|
||||
*/
|
||||
class PluginLoaderIndirection {
|
||||
|
||||
static ClassLoader createLoader(ClassLoader parent, List<ClassLoader> extendedLoaders) {
|
||||
return ExtendedPluginsClassLoader.create(parent, extendedLoaders);
|
||||
}
|
||||
}
|
|
@ -468,7 +468,7 @@ public class PluginsService implements ReportingService<PluginsAndModules> {
|
|||
);
|
||||
}
|
||||
|
||||
final ClassLoader parentLoader = PluginLoaderIndirection.createLoader(
|
||||
final ClassLoader parentLoader = ExtendedPluginsClassLoader.create(
|
||||
getClass().getClassLoader(),
|
||||
extendedPlugins.stream().map(LoadedPlugin::loader).toList()
|
||||
);
|
||||
|
|
|
@ -53,11 +53,6 @@ grant codeBase "${codebase.lucene-misc}" {
|
|||
permission java.nio.file.LinkPermission "hard";
|
||||
};
|
||||
|
||||
grant codeBase "${codebase.elasticsearch-plugin-classloader}" {
|
||||
// needed to create the classloader which allows plugins to extend other plugins
|
||||
permission java.lang.RuntimePermission "createClassLoader";
|
||||
};
|
||||
|
||||
grant codeBase "${codebase.elasticsearch-core}" {
|
||||
permission java.lang.RuntimePermission "createClassLoader";
|
||||
permission java.lang.RuntimePermission "getClassLoader";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue