Repository: quarkusio/quarkus
Issue: java.lang.IllegalStateException: Shutdown in progress exception while destroying Quarkus app

**Describe the bug**
When CTRL+C'ing a Quarkus app, the following stacktrace appears in the console:

```
^C2019-09-18 18:07:28,429 ERROR [io.qua.run.StartupContext] (main) Running a shutdown task failed: java.lang.IllegalStateException: Shutdown in progress
	at java.lang.ApplicationShutdownHooks.add(ApplicationShutdownHooks.java:66)
	at java.lang.Runtime.addShutdownHook(Runtime.java:211)
	at io.vertx.core.file.impl.FileResolver.setupCacheDir(FileResolver.java:351)
	at io.vertx.core.file.impl.FileResolver.<init>(FileResolver.java:87)
	at io.vertx.core.impl.VertxImpl.<init>(VertxImpl.java:165)
	at io.vertx.core.impl.VertxImpl.vertx(VertxImpl.java:92)
	at io.vertx.core.impl.VertxFactoryImpl.vertx(VertxFactoryImpl.java:40)
	at io.vertx.core.impl.VertxFactoryImpl.vertx(VertxFactoryImpl.java:32)
	at io.vertx.core.Vertx.vertx(Vertx.java:85)
	at io.quarkus.vertx.core.runtime.VertxCoreRecorder.initialize(VertxCoreRecorder.java:133)
	at io.quarkus.vertx.core.runtime.VertxCoreRecorder$1.get(VertxCoreRecorder.java:52)
	at io.quarkus.vertx.core.runtime.VertxCoreRecorder$1.get(VertxCoreRecorder.java:45)
	at io.quarkus.vertx.core.runtime.VertxCoreRecorder.destroy(VertxCoreRecorder.java:168)
	at io.quarkus.vertx.core.runtime.VertxCoreRecorder$2.run(VertxCoreRecorder.java:64)
	at io.quarkus.runtime.StartupContext.close(StartupContext.java:43)
	at io.quarkus.runner.ApplicationImpl1.doStop(ApplicationImpl1.zig:172)
	at io.quarkus.runtime.Application.stop(Application.java:158)
	at io.quarkus.runtime.Application.run(Application.java:211)
	at io.quarkus.runner.GeneratedMain.main(GeneratedMain.zig:34)

```
**Expected behavior**
No stacktrace

**Actual behavior**
Shows stacktrace

**To Reproduce**
Steps to reproduce the behavior:
1. Any Quarkus app running latest master
2. Press Ctrl +C  
3. Stacktrace is shown

**Environment (please complete the following information):**
 - Output of `uname -a` or `ver`: Linux ggastald-laptop 5.2.13-200.fc30.x86_64 #1 SMP Fri Sep 6 14:30:40 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
 - Output of `java -version`: 
openjdk version "1.8.0_212"
OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_212-b03)
OpenJDK 64-Bit Server VM (AdoptOpenJDK)(build 25.212-b03, mixed mode)

 - GraalVM version (if different from Java): 
 - Quarkus version or git rev: bf2440135785244b174ff19432aa46a1f873b7ea

**Additional context**
(Add any other context about the problem here.)

Doesn't happen with 0.22.0

Changed files:
extensions/vertx-core/runtime/src/test/java/io/quarkus/vertx/core/runtime/VertxCoreProducerTest.java
extensions/vertx-core/runtime/src/main/java/io/quarkus/vertx/core/runtime/VertxCoreRecorder.java

diff --git a/extensions/vertx-core/runtime/src/main/java/io/quarkus/vertx/core/runtime/VertxCoreRecorder.java b/extensions/vertx-core/runtime/src/main/java/io/quarkus/vertx/core/runtime/VertxCoreRecorder.java
index 2df951413de..93d245f891e 100644
--- a/extensions/vertx-core/runtime/src/main/java/io/quarkus/vertx/core/runtime/VertxCoreRecorder.java
+++ b/extensions/vertx-core/runtime/src/main/java/io/quarkus/vertx/core/runtime/VertxCoreRecorder.java
@@ -36,25 +36,13 @@ public class VertxCoreRecorder {
 
     public static final String ENABLE_JSON = "quarkus-internal.vertx.enabled-json";
 
-    static volatile Supplier<Vertx> vertx;
+    static volatile VertxSupplier vertx;
     //temporary vertx instance to work around a JAX-RS problem
     static volatile Vertx webVertx;
 
     public Supplier<Vertx> configureVertx(BeanContainer container, VertxConfiguration config,
             LaunchMode launchMode, ShutdownContext shutdown) {
-        vertx = new Supplier<Vertx>() {
-
-            Vertx v;
-
-            @Override
-            public synchronized Vertx get() {
-                if (v == null) {
-                    v = initialize(config);
-                }
-                return v;
-            }
-        };
-
+        vertx = new VertxSupplier(config);
         VertxCoreProducer producer = container.instance(VertxCoreProducer.class);
         producer.initialize(vertx);
         if (launchMode != LaunchMode.DEVELOPMENT) {
@@ -162,10 +150,10 @@ private static VertxOptions convertToVertxOptions(VertxConfiguration conf) {
     }
 
     void destroy() {
-        if (vertx != null) {
+        if (vertx != null && vertx.v != null) {
             CountDownLatch latch = new CountDownLatch(1);
             AtomicReference<Throwable> problem = new AtomicReference<>();
-            vertx.get().close(ar -> {
+            vertx.v.close(ar -> {
                 if (ar.failed()) {
                     problem.set(ar.cause());
                 }
@@ -303,7 +291,7 @@ public Supplier<EventLoopGroup> bossSupplier() {
         return new Supplier<EventLoopGroup>() {
             @Override
             public EventLoopGroup get() {
-                return ((VertxImpl) vertx).getAcceptorEventLoopGroup();
+                return ((VertxImpl) vertx.get()).getAcceptorEventLoopGroup();
             }
         };
     }
@@ -316,4 +304,21 @@ public EventLoopGroup get() {
             }
         };
     }
+
+    static class VertxSupplier implements Supplier<Vertx> {
+        final VertxConfiguration config;
+        Vertx v;
+
+        VertxSupplier(VertxConfiguration config) {
+            this.config = config;
+        }
+
+        @Override
+        public synchronized Vertx get() {
+            if (v == null) {
+                v = initialize(config);
+            }
+            return v;
+        }
+    }
 }
diff --git a/extensions/vertx-core/runtime/src/test/java/io/quarkus/vertx/core/runtime/VertxCoreProducerTest.java b/extensions/vertx-core/runtime/src/test/java/io/quarkus/vertx/core/runtime/VertxCoreProducerTest.java
index fdda5a95bfb..b585e6a9603 100644
--- a/extensions/vertx-core/runtime/src/test/java/io/quarkus/vertx/core/runtime/VertxCoreProducerTest.java
+++ b/extensions/vertx-core/runtime/src/test/java/io/quarkus/vertx/core/runtime/VertxCoreProducerTest.java
@@ -54,12 +54,7 @@ public void shouldNotFailWithDefaultConfig() {
         configuration.workerPoolSize = 10;
         configuration.warningExceptionTime = Duration.ofSeconds(1);
         configuration.internalBlockingPoolSize = 5;
-        VertxCoreRecorder.vertx = new Supplier<Vertx>() {
-            @Override
-            public Vertx get() {
-                return VertxCoreRecorder.initialize(configuration);
-            }
-        };
+        VertxCoreRecorder.vertx = new VertxCoreRecorder.VertxSupplier(configuration);
         producer.initialize(VertxCoreRecorder.vertx);
         verifyProducer();
     }