This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/main by this push:
     new 825b9b07b8c Fix CS
825b9b07b8c is described below

commit 825b9b07b8cf076bec899f69795e661f2052646f
Author: Claus Ibsen <[email protected]>
AuthorDate: Sun Nov 6 09:24:55 2022 +0100

    Fix CS
---
 .../main/download/CircuitBreakerDownloader.java    | 60 ++++++++++------------
 1 file changed, 27 insertions(+), 33 deletions(-)

diff --git 
a/dsl/camel-kamelet-main/src/main/java/org/apache/camel/main/download/CircuitBreakerDownloader.java
 
b/dsl/camel-kamelet-main/src/main/java/org/apache/camel/main/download/CircuitBreakerDownloader.java
index 0b4f367864f..3e2cca7c6d9 100644
--- 
a/dsl/camel-kamelet-main/src/main/java/org/apache/camel/main/download/CircuitBreakerDownloader.java
+++ 
b/dsl/camel-kamelet-main/src/main/java/org/apache/camel/main/download/CircuitBreakerDownloader.java
@@ -16,59 +16,53 @@
  */
 package org.apache.camel.main.download;
 
-import java.util.function.BiFunction;
-
-import org.apache.camel.Route;
 import org.apache.camel.model.CircuitBreakerDefinition;
 import org.apache.camel.model.ModelCamelContext;
-import org.apache.camel.model.ProcessorDefinition;
 import org.apache.camel.reifier.ProcessReifier;
 import org.apache.camel.reifier.ProcessorReifier;
 
 /**
  * When using circuit breakers then we need to download the runtime 
implementation
  */
-public class CircuitBreakerDownloader {
+public final class CircuitBreakerDownloader {
+
+    private CircuitBreakerDownloader() {
+    }
 
     public static void registerDownloadReifiers() {
         ProcessorReifier.registerReifier(CircuitBreakerDefinition.class,
-                new BiFunction<Route, ProcessorDefinition<?>, 
ProcessorReifier<? extends ProcessorDefinition<?>>>() {
-                    @Override
-                    public ProcessorReifier<? extends ProcessorDefinition<?>> 
apply(
-                            Route route, ProcessorDefinition<?> 
processorDefinition) {
-                        if (processorDefinition instanceof 
CircuitBreakerDefinition) {
-                            CircuitBreakerDefinition cb = 
(CircuitBreakerDefinition) processorDefinition;
-                            DependencyDownloader downloader = 
route.getCamelContext().hasService(DependencyDownloader.class);
-                            if (downloader != null) {
-                                String artifactId = null;
-                                if (cb.getResilience4jConfiguration() != null) 
{
+                (route, processorDefinition) -> {
+                    if (processorDefinition instanceof 
CircuitBreakerDefinition) {
+                        CircuitBreakerDefinition cb = 
(CircuitBreakerDefinition) processorDefinition;
+                        DependencyDownloader downloader = 
route.getCamelContext().hasService(DependencyDownloader.class);
+                        if (downloader != null) {
+                            if (cb.getResilience4jConfiguration() != null) {
+                                
downloader.downloadDependency("org.apache.camel", "camel-resilience4j",
+                                        route.getCamelContext().getVersion());
+                            }
+                            if (cb.getFaultToleranceConfiguration() != null) {
+                                
downloader.downloadDependency("org.apache.camel", 
"camel-microprofile-fault-tolerance",
+                                        route.getCamelContext().getVersion());
+                            }
+                            if (cb.getConfiguration() != null) {
+                                String id = cb.getConfiguration();
+                                Object cfg = 
route.getCamelContext().adapt(ModelCamelContext.class)
+                                        .getResilience4jConfiguration(id);
+                                if (cfg != null) {
                                     
downloader.downloadDependency("org.apache.camel", "camel-resilience4j",
                                             
route.getCamelContext().getVersion());
                                 }
-                                if (cb.getFaultToleranceConfiguration() != 
null) {
+                                cfg = 
route.getCamelContext().adapt(ModelCamelContext.class)
+                                        .getFaultToleranceConfiguration(id);
+                                if (cfg != null) {
                                     
downloader.downloadDependency("org.apache.camel", 
"camel-microprofile-fault-tolerance",
                                             
route.getCamelContext().getVersion());
                                 }
-                                if (cb.getConfiguration() != null) {
-                                    String id = cb.getConfiguration();
-                                    Object cfg = 
route.getCamelContext().adapt(ModelCamelContext.class)
-                                            .getResilience4jConfiguration(id);
-                                    if (cfg != null) {
-                                        
downloader.downloadDependency("org.apache.camel", "camel-resilience4j",
-                                                
route.getCamelContext().getVersion());
-                                    }
-                                    cfg = 
route.getCamelContext().adapt(ModelCamelContext.class)
-                                            
.getFaultToleranceConfiguration(id);
-                                    if (cfg != null) {
-                                        
downloader.downloadDependency("org.apache.camel", 
"camel-microprofile-fault-tolerance",
-                                                
route.getCamelContext().getVersion());
-                                    }
-                                }
                             }
                         }
-                        // use core reifier now we have downloaded JARs if 
needed
-                        return ProcessReifier.coreReifier(route, 
processorDefinition);
                     }
+                    // use core reifier now we have downloaded JARs if needed
+                    return ProcessReifier.coreReifier(route, 
processorDefinition);
                 });
     }
 

Reply via email to