davsclaus commented on code in PR #12985: URL: https://github.com/apache/camel/pull/12985#discussion_r1491991320
########## components/camel-platform-http-jolokia/src/main/java/org/apache/camel/component/platform/http/plugin/DefaultJolokiaPlatformHttpPlugin.java: ########## @@ -58,21 +62,22 @@ public JolokiaHttpRequestHandlerSupport() { serviceManager.addService(new JolokiaSerializer()); serviceManager.addService(new LocalRequestHandler(1)); - LOG.info("Creating JolokiaHttpRequestHandlerSupport with restrictor {}", restrictor); + LOG.info("Creating DefaultJolokiaPlatformHttpPlugin with restrictor {}", restrictor); } @Override - public void start() { + public void doStart() { var jolokiaContext = serviceManager.start(); requestHandler = new HttpRequestHandler(jolokiaContext); } @Override - public void stop() { + public void doStop() { serviceManager.stop(); Review Comment: Add if (serviceManager != null) ########## components/camel-platform-http-main/src/main/java/org/apache/camel/component/platform/http/main/MainHttpServer.java: ########## @@ -465,17 +479,22 @@ protected void setupJolokia() { platformHttpComponent.addHttpEndpoint("/q/jolokia", null, null); } + protected PlatformHttpPluginRegistry resolvePlatformHttpPluginRegistry() { + Optional<PlatformHttpPluginRegistry> result = ResolverHelper.resolveService( + getCamelContext(), + PlatformHttpPluginRegistry.FACTORY, + PlatformHttpPluginRegistry.class); + return result.orElse(null); + } + private HttpRequestHandler getHttpRequestHandler() { - //TODO: make jolokiaService more pluggable - //JolokiaHttpRequestHandlerSupport jolokiaService = camelContext.getCamelContextExtension().getContextPlugin(JolokiaHttpRequestHandlerSupport.class); - HttpRequestHandler requestHandler; - try (JolokiaHttpRequestHandlerSupport jolokiaService = new JolokiaHttpRequestHandlerSupport()) { - jolokiaService.start(); - requestHandler = jolokiaService.getHttpRequestHandler(); - } catch (IOException e) { - throw new RuntimeException(e); - } - return requestHandler; + PlatformHttpPluginRegistry registry + = camelContext.getCamelContextExtension().getContextPlugin(PlatformHttpPluginRegistry.class); + JolokiaPlatformHttpPlugin jolokia Review Comment: Jolokia should only be discovered if jolokiaEnabled ########## components/camel-platform-http-jolokia/pom.xml: ########## @@ -0,0 +1,95 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.apache.camel</groupId> + <artifactId>components</artifactId> + <version>4.4.0-SNAPSHOT</version> + </parent> + + <artifactId>camel-platform-http-jolokia</artifactId> + <packaging>jar</packaging> + + <name>Camel :: Platform HTTP :: Jolokia</name> + <description>Jolokia plugin for standalone Camel HTTP Platform</description> + + <properties> + <firstVersion>4.4.0</firstVersion> Review Comment: 4.5.0 -- 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: commits-unsubscr...@camel.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org