From 5b1ff1de664b009cc179cdc306ced423f591012f Mon Sep 17 00:00:00 2001 From: Joshua Bauer Date: Thu, 19 Nov 2020 17:22:12 -0800 Subject: [PATCH] Async service timeouts. --- CHANGELOG.md | 9 +++++++++ pom.xml | 2 +- .../sinistral/proteus/ProteusApplication.java | 20 ++++++++++++------- 3 files changed, 23 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d54438a..d333077 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,15 @@ # Changelog Proteus Changelog. +## Unreleased +### No issue + +**Controllers are now compiled in parallel.** + + +[a9f4e75734b3515](https://github.com/noboomu/proteus/commit/a9f4e75734b3515) Joshua Bauer *2020-11-19 21:22:26* + + ## v0.4.6 ### No issue diff --git a/pom.xml b/pom.xml index 51f3430..d259c60 100644 --- a/pom.xml +++ b/pom.xml @@ -57,7 +57,7 @@ 6.0.3 3.9 1.11.1 - 0.9.11 + 0.9.12 4.4.12 1.2.3 2.0.6 diff --git a/proteus-core/src/main/java/io/sinistral/proteus/ProteusApplication.java b/proteus-core/src/main/java/io/sinistral/proteus/ProteusApplication.java index d82a810..f0fb0ec 100644 --- a/proteus-core/src/main/java/io/sinistral/proteus/ProteusApplication.java +++ b/proteus-core/src/main/java/io/sinistral/proteus/ProteusApplication.java @@ -30,11 +30,8 @@ import io.undertow.util.Headers; import io.undertow.util.Methods; import org.apache.commons.lang3.time.DurationFormatUtils; -import org.checkerframework.checker.units.qual.C; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.xnio.Options; - import javax.ws.rs.core.MediaType; import java.io.ByteArrayOutputStream; import java.io.File; @@ -51,7 +48,6 @@ import java.util.List; import java.util.Map; import java.util.Set; -import java.util.concurrent.CompletableFuture; import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.CountDownLatch; import java.util.concurrent.ExecutorService; @@ -171,13 +167,15 @@ public void start() serviceManager.addListener(new Listener() { public void stopped() { - + log.info("Services are stopped"); undertow.stop(); } public void healthy() { + log.info("Services are healthy"); + startupDuration = Duration.ofMillis(System.currentTimeMillis() - startTime); for (ListenerInfo info : undertow.getListenerInfo()) @@ -246,7 +244,15 @@ public void failure(Service service) undertow.start(); - serviceManager.startAsync(); + try + { + serviceManager.startAsync().awaitHealthy(120L, TimeUnit.SECONDS); + } catch( Exception e ) + { + log.error("Failed start to services within 2 minutes",e); + } + +// serviceManager.startAsync(); } @@ -265,7 +271,7 @@ public void shutdown() throws TimeoutException this.running.set(false); - log.info("Shutdown complete."); + log.info("Shutdown complete"); } public boolean isRunning()