Repository: quarkusio/quarkus
Issue: quarkus-vertx-web hangs if port is in use

**Describe the bug**

When starting a quarkus vertx web app that listens on a port that is in use, the quarkus process hangs and does not respond to SIGTERM. 

**Expected behavior**

It would be acceptable for the application to exit with error message informing that the port is in use.

**Actual behavior**

The application hangs with no logs and does not respond to SIGTERM.

**To Reproduce**
Steps to reproduce the behavior:
1. Start an http service listening on port 8080
2. Start a quarkus-vertx-web app listening on port 8080 (default). This was tried in JVM and Native modes.
3. Try to stop the quarkus-vertx-web app via SIGTERM.

**Environment (please complete the following information):**
 - Output of `uname -a` or `ver`: 
```
Linux <host-redacted> 5.0.16-200.fc29.x86_64 #1 SMP Tue May 14 18:27:35 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
```
 - GraalVM version (if different from Java): 
```
graalvm-ce-1.0.0-rc16
```
 - Quarkus version or git rev: 
```
<dependency>
    <groupId>io.quarkus</groupId>
    <artifactId>quarkus-vertx-web</artifactId>
    <version>0.15.0</version>
</dependency>

```


Changed files:
extensions/vertx-web/runtime/src/main/java/io/quarkus/vertx/web/runtime/VertxWebTemplate.java

diff --git a/extensions/vertx-web/runtime/src/main/java/io/quarkus/vertx/web/runtime/VertxWebTemplate.java b/extensions/vertx-web/runtime/src/main/java/io/quarkus/vertx/web/runtime/VertxWebTemplate.java
index f3aa6ac8181..97ac66c3f1f 100644
--- a/extensions/vertx-web/runtime/src/main/java/io/quarkus/vertx/web/runtime/VertxWebTemplate.java
+++ b/extensions/vertx-web/runtime/src/main/java/io/quarkus/vertx/web/runtime/VertxWebTemplate.java
@@ -6,6 +6,7 @@
 import java.util.Map;
 import java.util.Map.Entry;
 import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.atomic.AtomicReference;
 
 import javax.enterprise.event.Event;
 
@@ -78,7 +79,7 @@ List<io.vertx.ext.web.Route> initialize(Vertx vertx, VertxHttpConfiguration vert
                 routes.add(addRoute(router, handler, route));
             }
         }
-        // Make it also possible to register the route handlers programatically
+        // Make it also possible to register the route handlers programmatically
         Event<Object> event = Arc.container().beanManager().getEvent();
         event.select(Router.class).fire(router);
 
@@ -88,17 +89,27 @@ List<io.vertx.ext.web.Route> initialize(Vertx vertx, VertxHttpConfiguration vert
             // Http server configuration
             HttpServerOptions httpServerOptions = createHttpServerOptions(vertxHttpConfiguration, launchMode);
             event.select(HttpServerOptions.class).fire(httpServerOptions);
+            AtomicReference<Throwable> failure = new AtomicReference<>();
             server = vertx.createHttpServer(httpServerOptions).requestHandler(router)
                     .listen(ar -> {
                         if (ar.succeeded()) {
                             // TODO log proper message
                             Timing.setHttpServer(String.format(
                                     "Listening on: http://%s:%s", httpServerOptions.getHost(), httpServerOptions.getPort()));
-                            latch.countDown();
+
+                        } else {
+                            // We can't throw an exception from here as we are on the event loop.
+                            // We store the failure in a reference.
+                            // The reference will be checked in the main thread, and the failure re-thrown.
+                            failure.set(ar.cause());
                         }
+                        latch.countDown();
                     });
             try {
                 latch.await();
+                if (failure.get() != null) {
+                    throw new IllegalStateException("Unable to start the HTTP server", failure.get());
+                }
             } catch (InterruptedException e) {
                 Thread.currentThread().interrupt();
                 throw new IllegalStateException("Unable to start the HTTP server", e);