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

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

commit 4aa7945901b449113617056909c7fa9c2a95eff4
Author: Gilvan Filho <[email protected]>
AuthorDate: Mon Dec 5 20:23:33 2022 -0300

    (chores) camel-cxf-spring-soap: replace inner class with lambda
---
 .../cxf/spring/jaxws/CxfSpringEndpoint.java        | 54 ++++++++++------------
 1 file changed, 25 insertions(+), 29 deletions(-)

diff --git 
a/components/camel-cxf/camel-cxf-spring-soap/src/main/java/org/apache/camel/component/cxf/spring/jaxws/CxfSpringEndpoint.java
 
b/components/camel-cxf/camel-cxf-spring-soap/src/main/java/org/apache/camel/component/cxf/spring/jaxws/CxfSpringEndpoint.java
index 0f2e2a6566b..8eb369b2642 100644
--- 
a/components/camel-cxf/camel-cxf-spring-soap/src/main/java/org/apache/camel/component/cxf/spring/jaxws/CxfSpringEndpoint.java
+++ 
b/components/camel-cxf/camel-cxf-spring-soap/src/main/java/org/apache/camel/component/cxf/spring/jaxws/CxfSpringEndpoint.java
@@ -322,39 +322,35 @@ public class CxfSpringEndpoint extends CxfEndpoint 
implements ApplicationContext
                     
.getBean(AbstractApplicationContext.APPLICATION_EVENT_MULTICASTER_BEAN_NAME,
                             ApplicationEventMulticaster.class);
             aem.removeApplicationListener(cxfSpringBusListener);
-            ApplicationListener listener = new ApplicationListener() {
-                public void onApplicationEvent(final ApplicationEvent event) {
-                    new Thread() {
-                        public void run() {
-                            if (event instanceof ContextClosedEvent && 
bus.getState() == BusState.RUNNING) {
-
-                                try {
-                                    boolean done = false;
-                                    ShutdownStrategy shutdownStrategy = 
((DefaultCamelContext) getCamelContext())
-                                            .getShutdownStrategy();
-                                    while (!done && 
!shutdownStrategy.hasTimeoutOccurred()) {
-                                        int inflight = 
getCamelContext().getInflightRepository().size();
-                                        if (inflight != 0) {
-                                            Thread.sleep(1000);
-                                        } else {
-                                            done = true;
-                                        }
-                                    }
-
-                                } catch (Exception e) {
 
-                                    LOG.debug("Error when enabling SpringBus 
shutdown gracefully", e);
+            abstractApplicationContext.addApplicationListener((final 
ApplicationEvent event) -> {
+                new Thread() {
+                    public void run() {
+                        if (event instanceof ContextClosedEvent && 
bus.getState() == BusState.RUNNING) {
+
+                            try {
+                                boolean done = false;
+                                ShutdownStrategy shutdownStrategy = 
((DefaultCamelContext) getCamelContext())
+                                        .getShutdownStrategy();
+                                while (!done && 
!shutdownStrategy.hasTimeoutOccurred()) {
+                                    int inflight = 
getCamelContext().getInflightRepository().size();
+                                    if (inflight != 0) {
+                                        Thread.sleep(1000);
+                                    } else {
+                                        done = true;
+                                    }
                                 }
-                                springBus.onApplicationEvent(event);
-                            } else {
-                                springBus.onApplicationEvent(event);
+
+                            } catch (Exception e) {
+                                LOG.debug("Error when enabling SpringBus 
shutdown gracefully", e);
                             }
+                            springBus.onApplicationEvent(event);
+                        } else {
+                            springBus.onApplicationEvent(event);
                         }
-                    }.start();
-
-                }
-            };
-            abstractApplicationContext.addApplicationListener(listener);
+                    }
+                }.start();
+            });
         }
 
     }

Reply via email to