From 4308e0c5b4e77e0f5fe0ae09ec8f6c6efc361a2a Mon Sep 17 00:00:00 2001 From: Alexander Fedulov <1492164+afedulov@users.noreply.github.com> Date: Fri, 21 Feb 2020 15:46:48 +0100 Subject: [PATCH] [FLINK-16222][core] Relax Plugin bounded type parameter constraint --- .../java/org/apache/flink/core/plugin/PluginLoader.java | 7 +++---- .../java/org/apache/flink/core/plugin/PluginManager.java | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/flink-core/src/main/java/org/apache/flink/core/plugin/PluginLoader.java b/flink-core/src/main/java/org/apache/flink/core/plugin/PluginLoader.java index 6dbe6753ab266..7287399cf39e6 100644 --- a/flink-core/src/main/java/org/apache/flink/core/plugin/PluginLoader.java +++ b/flink-core/src/main/java/org/apache/flink/core/plugin/PluginLoader.java @@ -20,7 +20,6 @@ import org.apache.flink.annotation.VisibleForTesting; import org.apache.flink.util.ArrayUtils; -import org.apache.flink.util.ChildFirstClassLoader; import org.apache.flink.util.TemporaryClassLoaderContext; import javax.annotation.concurrent.ThreadSafe; @@ -35,7 +34,7 @@ /** * A {@link PluginLoader} is used by the {@link PluginManager} to load a single plugin. It is essentially a combination - * of a {@link ChildFirstClassLoader} and {@link ServiceLoader}. This class can locate and load service implementations + * of a {@link PluginClassLoader} and {@link ServiceLoader}. This class can locate and load service implementations * from the plugin for a given SPI. The {@link PluginDescriptor}, which among other information contains the resource * URLs, is provided at construction. */ @@ -69,7 +68,7 @@ public static PluginLoader create(PluginDescriptor pluginDescriptor, ClassLoader * @param
Type of the requested plugin service. * @return An iterator of all implementations of the given service interface that could be loaded from the plugin. */ - public
Iterator
load(Class
service) { + public
Iterator
load(Class
service) { try (TemporaryClassLoaderContext ignored = TemporaryClassLoaderContext.of(pluginClassLoader)) { return new ContextClassLoaderSettingIterator<>( ServiceLoader.load(service, pluginClassLoader).iterator(), @@ -83,7 +82,7 @@ public
Iterator
load(Class
service) { * * @param
type of the iterated plugin element. */ - static class ContextClassLoaderSettingIterator
implements Iterator
{ + static class ContextClassLoaderSettingIterator
implements Iterator
{ private final Iterator
delegate;
private final ClassLoader pluginClassLoader;
diff --git a/flink-core/src/main/java/org/apache/flink/core/plugin/PluginManager.java b/flink-core/src/main/java/org/apache/flink/core/plugin/PluginManager.java
index 23857326d5a6d..8d50585411a36 100644
--- a/flink-core/src/main/java/org/apache/flink/core/plugin/PluginManager.java
+++ b/flink-core/src/main/java/org/apache/flink/core/plugin/PluginManager.java
@@ -63,7 +63,7 @@ public PluginManager(Collection Type of the requested plugin service.
* @return Iterator over all implementations of the given service that could be loaded from all known plugins.
*/
- public Iterator load(Class service) {
+ public Iterator load(Class service) {
ArrayList