You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by pp...@apache.org on 2020/07/16 12:26:48 UTC
[camel-quarkus] branch master updated: Fixup #1468 Intermittent
failure of CamelDevModeTest
This is an automated email from the ASF dual-hosted git repository.
ppalaga pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git
The following commit(s) were added to refs/heads/master by this push:
new 7c81c50 Fixup #1468 Intermittent failure of CamelDevModeTest
7c81c50 is described below
commit 7c81c5093887c57316c390bc1534326caa094141
Author: Peter Palaga <pp...@redhat.com>
AuthorDate: Thu Jul 16 11:09:13 2020 +0200
Fixup #1468 Intermittent failure of CamelDevModeTest
---
.../apache/camel/quarkus/main/CamelMainRuntime.java | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)
diff --git a/extensions-core/main/runtime/src/main/java/org/apache/camel/quarkus/main/CamelMainRuntime.java b/extensions-core/main/runtime/src/main/java/org/apache/camel/quarkus/main/CamelMainRuntime.java
index d12c1f8..dd9b329 100644
--- a/extensions-core/main/runtime/src/main/java/org/apache/camel/quarkus/main/CamelMainRuntime.java
+++ b/extensions-core/main/runtime/src/main/java/org/apache/camel/quarkus/main/CamelMainRuntime.java
@@ -17,7 +17,6 @@
package org.apache.camel.quarkus.main;
import java.util.Arrays;
-import java.util.concurrent.TimeUnit;
import io.quarkus.runtime.Quarkus;
import org.apache.camel.CamelContext;
@@ -32,6 +31,7 @@ public class CamelMainRuntime implements CamelRuntime {
private static final Logger LOGGER = LoggerFactory.getLogger(CamelMainRuntime.class);
private final CamelMain main;
private final long shutdownTimeoutMs;
+ private volatile Thread mainThread;
public CamelMainRuntime(CamelMain main, long shutdownTimeoutMs) {
this.main = main;
@@ -48,7 +48,7 @@ public class CamelMainRuntime implements CamelRuntime {
main.parseArguments(args);
main.startEngine();
- new Thread(() -> {
+ final Thread worker = new Thread(() -> {
try {
main.runEngine();
} catch (Exception e) {
@@ -56,7 +56,9 @@ public class CamelMainRuntime implements CamelRuntime {
stop();
throw new RuntimeException(e);
}
- }, "camel-main").start();
+ }, "camel-main");
+ this.mainThread = worker;
+ worker.start();
} catch (Exception e) {
LOGGER.error("Failed to start application", e);
stop();
@@ -68,10 +70,13 @@ public class CamelMainRuntime implements CamelRuntime {
public void stop() {
main.stop();
/* Wait till the Camel shutdown is finished in camel-main thread started in start(String[]) above */
- try {
- main.getShutdownStrategy().await(shutdownTimeoutMs, TimeUnit.MILLISECONDS);
- } catch (InterruptedException e) {
- Thread.currentThread().interrupt();
+ final Thread worker = this.mainThread;
+ if (worker != null) {
+ try {
+ worker.join(shutdownTimeoutMs);
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ }
}
}