diff --git a/presto-main/src/main/java/com/facebook/presto/server/PluginManager.java b/presto-main/src/main/java/com/facebook/presto/server/PluginManager.java index f8d286f3108cb..fefc37a352506 100644 --- a/presto-main/src/main/java/com/facebook/presto/server/PluginManager.java +++ b/presto-main/src/main/java/com/facebook/presto/server/PluginManager.java @@ -32,13 +32,11 @@ import com.facebook.presto.spi.CoordinatorPlugin; import com.facebook.presto.spi.Plugin; import com.facebook.presto.spi.analyzer.AnalyzerProvider; -import com.facebook.presto.spi.analyzer.QueryPreparerProvider; import com.facebook.presto.spi.classloader.ThreadContextClassLoader; import com.facebook.presto.spi.connector.ConnectorFactory; import com.facebook.presto.spi.eventlistener.EventListenerFactory; import com.facebook.presto.spi.function.FunctionNamespaceManagerFactory; import com.facebook.presto.spi.nodestatus.NodeStatusNotificationProviderFactory; -import com.facebook.presto.spi.plan.PlanCheckerProviderFactory; import com.facebook.presto.spi.prerequisites.QueryPrerequisitesFactory; import com.facebook.presto.spi.resourceGroups.ResourceGroupConfigurationManagerFactory; import com.facebook.presto.spi.security.PasswordAuthenticatorFactory; @@ -108,10 +106,8 @@ public class PluginManager .add("com.facebook.drift.TApplicationException") .build(); - // TODO: To make CoordinatorPlugin loading compulsory when native execution is enabled. - private static final String COORDINATOR_PLUGIN_SERVICES_FILE = "META-INF/services/" + CoordinatorPlugin.class.getName(); - private static final String PLUGIN_SERVICES_FILE = "META-INF/services/" + Plugin.class.getName(); private static final Logger log = Logger.get(PluginManager.class); + private final ConnectorManager connectorManager; private final Metadata metadata; private final ResourceGroupManager resourceGroupManager; @@ -133,7 +129,6 @@ public class PluginManager private final HistoryBasedPlanStatisticsManager historyBasedPlanStatisticsManager; private final TracerProviderManager tracerProviderManager; private final AnalyzerProviderManager analyzerProviderManager; - private final QueryPreparerProviderManager queryPreparerProviderManager; private final NodeStatusNotificationManager nodeStatusNotificationManager; private final PlanCheckerProviderManager planCheckerProviderManager; private final ClientRequestFilterManager clientRequestFilterManager; @@ -146,7 +141,6 @@ public PluginManager( Metadata metadata, ResourceGroupManager resourceGroupManager, AnalyzerProviderManager analyzerProviderManager, - QueryPreparerProviderManager queryPreparerProviderManager, AccessControlManager accessControlManager, PasswordAuthenticatorManager passwordAuthenticatorManager, EventListenerManager eventListenerManager, @@ -190,7 +184,6 @@ public PluginManager( this.historyBasedPlanStatisticsManager = requireNonNull(historyBasedPlanStatisticsManager, "historyBasedPlanStatisticsManager is null"); this.tracerProviderManager = requireNonNull(tracerProviderManager, "tracerProviderManager is null"); this.analyzerProviderManager = requireNonNull(analyzerProviderManager, "analyzerProviderManager is null"); - this.queryPreparerProviderManager = requireNonNull(queryPreparerProviderManager, "queryPreparerProviderManager is null"); this.nodeStatusNotificationManager = requireNonNull(nodeStatusNotificationManager, "nodeStatusNotificationManager is null"); this.planCheckerProviderManager = requireNonNull(planCheckerProviderManager, "planCheckerProviderManager is null"); this.clientRequestFilterManager = requireNonNull(clientRequestFilterManager, "clientRequestFilterManager is null"); @@ -224,32 +217,23 @@ private void loadPlugin(String plugin) log.info("-- Loading plugin %s --", plugin); URLClassLoader pluginClassLoader = buildClassLoader(plugin); try (ThreadContextClassLoader ignored = new ThreadContextClassLoader(pluginClassLoader)) { - loadPlugin(pluginClassLoader, CoordinatorPlugin.class); - loadPlugin(pluginClassLoader, Plugin.class); + loadPlugin(pluginClassLoader); } log.info("-- Finished loading plugin %s --", plugin); } - private void loadPlugin(URLClassLoader pluginClassLoader, Class clazz) + private void loadPlugin(URLClassLoader pluginClassLoader) { - ServiceLoader serviceLoader = ServiceLoader.load(clazz, pluginClassLoader); - List plugins = ImmutableList.copyOf(serviceLoader); + ServiceLoader serviceLoader = ServiceLoader.load(Plugin.class, pluginClassLoader); + List plugins = ImmutableList.copyOf(serviceLoader); if (plugins.isEmpty()) { - log.warn("No service providers of type %s", clazz.getName()); + log.warn("No service providers of type %s", Plugin.class.getName()); } - for (Object plugin : plugins) { + for (Plugin plugin : plugins) { log.info("Installing %s", plugin.getClass().getName()); - if (plugin instanceof Plugin) { - installPlugin((Plugin) plugin); - } - else if (plugin instanceof CoordinatorPlugin) { - installCoordinatorPlugin((CoordinatorPlugin) plugin); - } - else { - log.warn("Unknown plugin type: %s", plugin.getClass().getName()); - } + installPlugin(plugin); } } diff --git a/presto-spi/src/main/java/com/facebook/presto/spi/Plugin.java b/presto-spi/src/main/java/com/facebook/presto/spi/Plugin.java index 34db9e0319635..4807ebdbf305c 100644 --- a/presto-spi/src/main/java/com/facebook/presto/spi/Plugin.java +++ b/presto-spi/src/main/java/com/facebook/presto/spi/Plugin.java @@ -17,12 +17,10 @@ import com.facebook.presto.common.type.ParametricType; import com.facebook.presto.common.type.Type; import com.facebook.presto.spi.analyzer.AnalyzerProvider; -import com.facebook.presto.spi.analyzer.QueryPreparerProvider; import com.facebook.presto.spi.connector.ConnectorFactory; import com.facebook.presto.spi.eventlistener.EventListenerFactory; import com.facebook.presto.spi.function.FunctionNamespaceManagerFactory; import com.facebook.presto.spi.nodestatus.NodeStatusNotificationProviderFactory; -import com.facebook.presto.spi.plan.PlanCheckerProviderFactory; import com.facebook.presto.spi.prerequisites.QueryPrerequisitesFactory; import com.facebook.presto.spi.resourceGroups.ResourceGroupConfigurationManagerFactory; import com.facebook.presto.spi.security.PasswordAuthenticatorFactory;