From 7b712541e8c1edf027183b7b99019b7f4881a534 Mon Sep 17 00:00:00 2001 From: Thomas Segismont Date: Wed, 2 Apr 2025 15:10:32 +0200 Subject: [PATCH] [#2174] Prepare for Vert.x 5 upgrade in Vert.x Context Closes #2174 Local context data management methods are deprecated and will be removed in Vert.x 5. This change will make it easier to upgrade to Vert.x 5 (should be just a matter of changing imports) --- .../reactive/context/impl/VertxContext.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/hibernate-reactive-core/src/main/java/org/hibernate/reactive/context/impl/VertxContext.java b/hibernate-reactive-core/src/main/java/org/hibernate/reactive/context/impl/VertxContext.java index 4448c9b6c..fef172e66 100644 --- a/hibernate-reactive-core/src/main/java/org/hibernate/reactive/context/impl/VertxContext.java +++ b/hibernate-reactive-core/src/main/java/org/hibernate/reactive/context/impl/VertxContext.java @@ -36,10 +36,10 @@ public void injectServices(ServiceRegistryImplementor serviceRegistry) { @Override public void put(Key key, T instance) { - final io.vertx.core.Context context = Vertx.currentContext(); + final ContextInternal context = ContextInternal.current(); if ( context != null ) { if ( trace ) LOG.tracef( "Putting key,value in context: [%1$s, %2$s]", key, instance ); - context.putLocal( key, instance ); + context.localContextData().put( key, instance ); } else { if ( trace ) LOG.tracef( "Context is null for key,value: [%1$s, %2$s]", key, instance ); @@ -49,9 +49,10 @@ public void put(Key key, T instance) { @Override public T get(Key key) { - final io.vertx.core.Context context = Vertx.currentContext(); + final ContextInternal context = ContextInternal.current(); if ( context != null ) { - T local = context.getLocal( key ); + @SuppressWarnings("unchecked") + T local = (T) context.localContextData().get( key ); if ( trace ) LOG.tracef( "Getting value %2$s from context for key %1$s", key, local ); return local; } @@ -63,9 +64,9 @@ public T get(Key key) { @Override public void remove(Key key) { - final io.vertx.core.Context context = Vertx.currentContext(); + final ContextInternal context = ContextInternal.current(); if ( context != null ) { - boolean removed = context.removeLocal( key ); + boolean removed = context.localContextData().remove( key ) != null; if ( trace ) LOG.tracef( "Key %s removed from context: %s", key, removed ); } else {