mimaison commented on a change in pull request #11572: URL: https://github.com/apache/kafka/pull/11572#discussion_r817909898
########## File path: connect/runtime/src/main/java/org/apache/kafka/connect/runtime/rest/resources/ConnectorPluginsResource.java ########## @@ -100,21 +135,23 @@ public ConfigInfos validateConfigs( @GET @Path("/") - public List<ConnectorPluginInfo> listConnectorPlugins() { - return getConnectorPlugins(); - } - - // TODO: improve once plugins are allowed to be added/removed during runtime. - private synchronized List<ConnectorPluginInfo> getConnectorPlugins() { - if (connectorPlugins.isEmpty()) { - for (PluginDesc<Connector> plugin : herder.plugins().connectors()) { - if (!CONNECTOR_EXCLUDES.contains(plugin.pluginClass())) { - connectorPlugins.add(new ConnectorPluginInfo(plugin)); - } + public List<ConnectorPluginInfo> listConnectorPlugins(@DefaultValue("true") @QueryParam("connectorsOnly") boolean connectorsOnly) { + synchronized (this) { + if (connectorsOnly) { + Set<String> types = new HashSet<>(Arrays.asList(PluginType.SINK.toString(), PluginType.SOURCE.toString())); + return Collections.unmodifiableList(connectorPlugins.stream().filter(p -> types.contains(p.type())).collect(Collectors.toList())); Review comment: Not really, I updated the logic to use `equals` and `||` -- 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. To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org