This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch feature/CAMEL-23857-tui-runtime-chooser in repository https://gitbox.apache.org/repos/asf/camel.git
commit a2f2531001a9119aaf65e0f4dd0a1493d0b2da79 Author: Claus Ibsen <[email protected]> AuthorDate: Tue Jun 30 09:02:19 2026 +0200 CAMEL-23857: Disable TUI restart for Spring Boot and Quarkus until reliable Co-Authored-By: Claude <[email protected]> Signed-off-by: Claus Ibsen <[email protected]> --- .../dsl/jbang/core/commands/tui/CamelMonitor.java | 80 ++-------------------- 1 file changed, 4 insertions(+), 76 deletions(-) diff --git a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/CamelMonitor.java b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/CamelMonitor.java index 2f405e5f5fb0..6550316f5b4d 100644 --- a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/CamelMonitor.java +++ b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/CamelMonitor.java @@ -24,7 +24,6 @@ import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.List; -import java.util.Locale; import java.util.Optional; import java.util.Queue; import java.util.concurrent.CompletableFuture; @@ -1200,84 +1199,13 @@ public class CamelMonitor extends CamelCommand { boolean isSpringBoot = "Spring Boot".equals(platform); boolean isQuarkus = "Quarkus".equals(platform); + // TODO: restart for Spring Boot and Quarkus is not yet reliable if (isSpringBoot || isQuarkus) { - restartMavenBasedProcess(ph, info, isSpringBoot); - } else { - restartCamelMainProcess(ph, info); - } - } - - private void restartMavenBasedProcess(ProcessHandle ph, IntegrationInfo info, boolean springBoot) { - String directory = info.directory; - if (directory == null || directory.isEmpty()) { - setNotification("Cannot restart: directory not available", true); + setNotification("Restart not supported for " + platform, true); return; } - Path dirPath = Path.of(directory); - boolean windows = System.getProperty("os.name", "").toLowerCase(Locale.ROOT).contains("win"); - String mvnw = windows ? "mvnw.cmd" : "mvnw"; - Path mvnwPath = dirPath.resolve(mvnw); - if (!Files.isRegularFile(mvnwPath)) { - setNotification("Cannot restart: Maven wrapper not found", true); - return; - } - - String name = info.name; - ctx.lastSelectedName = name; - - // kill the process (Maven parent will also exit) - ph.destroy(); - setNotification("Restarting: " + name, false); - - if (runner != null) { - runner.scheduler().execute(() -> { - try { - // wait for process termination - try { - ph.onExit().toCompletableFuture().get(10, TimeUnit.SECONDS); - } catch (Exception e) { - ph.destroyForcibly(); - Thread.sleep(500); - } - // also wait for parent (Maven) to exit - ProcessHandle parent = ph.parent().orElse(null); - if (parent != null && parent.isAlive()) { - try { - parent.onExit().toCompletableFuture().get(5, TimeUnit.SECONDS); - } catch (Exception e) { - parent.destroyForcibly(); - } - } - - // re-launch via Maven wrapper - List<String> cmd = new ArrayList<>(); - cmd.add(mvnwPath.toString()); - cmd.add("--quiet"); - cmd.add("--file"); - cmd.add(dirPath.resolve("pom.xml").toString()); - if (springBoot) { - cmd.add("spring-boot:run"); - } else { - cmd.add("package"); - cmd.add("quarkus:dev"); - } - - ProcessBuilder pb = new ProcessBuilder(cmd); - pb.directory(dirPath.toFile()); - pb.redirectErrorStream(true); - Path outputFile = Files.createTempFile("camel-restart-", ".log"); - outputFile.toFile().deleteOnExit(); - pb.redirectOutput(outputFile.toFile()); - pb.start(); - - runner.runOnRenderThread(() -> setNotification("Restarted: " + name, false)); - } catch (Exception e) { - runner.runOnRenderThread( - () -> setNotification("Restart failed: " + e.getMessage(), true)); - } - }); - } + restartCamelMainProcess(ph, info); } private void restartCamelMainProcess(ProcessHandle ph, IntegrationInfo info) { @@ -1346,7 +1274,7 @@ public class CamelMonitor extends CamelCommand { private void setNotification(String message, boolean error) { monitorNotification = message; monitorNotificationError = error; - monitorNotificationExpiry = System.currentTimeMillis() + 5000; + monitorNotificationExpiry = System.currentTimeMillis() + (error ? 15000 : 5000); } static List<String> parseCommandLine(String commandLine) {
