@@ -36,25 +36,13 @@ public class VertxCoreRecorder {
3636
3737 public static final String ENABLE_JSON = "quarkus-internal.vertx.enabled-json" ;
3838
39- static volatile Supplier < Vertx > vertx ;
39+ static volatile VertxSupplier vertx ;
4040 //temporary vertx instance to work around a JAX-RS problem
4141 static volatile Vertx webVertx ;
4242
4343 public Supplier <Vertx > configureVertx (BeanContainer container , VertxConfiguration config ,
4444 LaunchMode launchMode , ShutdownContext shutdown ) {
45- vertx = new Supplier <Vertx >() {
46-
47- Vertx v ;
48-
49- @ Override
50- public synchronized Vertx get () {
51- if (v == null ) {
52- v = initialize (config );
53- }
54- return v ;
55- }
56- };
57-
45+ vertx = new VertxSupplier (config );
5846 VertxCoreProducer producer = container .instance (VertxCoreProducer .class );
5947 producer .initialize (vertx );
6048 if (launchMode != LaunchMode .DEVELOPMENT ) {
@@ -162,10 +150,10 @@ private static VertxOptions convertToVertxOptions(VertxConfiguration conf) {
162150 }
163151
164152 void destroy () {
165- if (vertx != null ) {
153+ if (vertx != null && vertx . v != null ) {
166154 CountDownLatch latch = new CountDownLatch (1 );
167155 AtomicReference <Throwable > problem = new AtomicReference <>();
168- vertx .get () .close (ar -> {
156+ vertx .v .close (ar -> {
169157 if (ar .failed ()) {
170158 problem .set (ar .cause ());
171159 }
@@ -303,7 +291,7 @@ public Supplier<EventLoopGroup> bossSupplier() {
303291 return new Supplier <EventLoopGroup >() {
304292 @ Override
305293 public EventLoopGroup get () {
306- return ((VertxImpl ) vertx ).getAcceptorEventLoopGroup ();
294+ return ((VertxImpl ) vertx . get () ).getAcceptorEventLoopGroup ();
307295 }
308296 };
309297 }
@@ -316,4 +304,21 @@ public EventLoopGroup get() {
316304 }
317305 };
318306 }
307+
308+ static class VertxSupplier implements Supplier <Vertx > {
309+ final VertxConfiguration config ;
310+ Vertx v ;
311+
312+ VertxSupplier (VertxConfiguration config ) {
313+ this .config = config ;
314+ }
315+
316+ @ Override
317+ public synchronized Vertx get () {
318+ if (v == null ) {
319+ v = initialize (config );
320+ }
321+ return v ;
322+ }
323+ }
319324}
0 commit comments