Skip to content

[2.4] Revert changes in preparation of Vert.x 5 #2236

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
import org.hibernate.service.spi.ServiceRegistryAwareService;
import org.hibernate.service.spi.ServiceRegistryImplementor;

import static org.hibernate.reactive.context.impl.ContextualDataStorage.contextualDataMap;

/**
* An adaptor for the Vert.x {@link io.vertx.core.Context}.
*
Expand All @@ -38,10 +36,10 @@ public void injectServices(ServiceRegistryImplementor serviceRegistry) {

@Override
public <T> void put(Key<T> key, T instance) {
final ContextInternal context = ContextInternal.current();
final io.vertx.core.Context context = Vertx.currentContext();
if ( context != null ) {
if ( trace ) LOG.tracef( "Putting key,value in context: [%1$s, %2$s]", key, instance );
ContextualDataStorage.<T>contextualDataMap( context ).put( key, instance );
context.putLocal( key, instance );
}
else {
if ( trace ) LOG.tracef( "Context is null for key,value: [%1$s, %2$s]", key, instance );
Expand All @@ -51,9 +49,9 @@ public <T> void put(Key<T> key, T instance) {

@Override
public <T> T get(Key<T> key) {
final ContextInternal context = ContextInternal.current();
final io.vertx.core.Context context = Vertx.currentContext();
if ( context != null ) {
T local = ContextualDataStorage.<T>contextualDataMap( context ).get( key );
T local = context.getLocal( key );
if ( trace ) LOG.tracef( "Getting value %2$s from context for key %1$s", key, local );
return local;
}
Expand All @@ -65,9 +63,9 @@ public <T> T get(Key<T> key) {

@Override
public void remove(Key<?> key) {
final ContextInternal context = ContextInternal.current();
final io.vertx.core.Context context = Vertx.currentContext();
if ( context != null ) {
boolean removed = contextualDataMap( context ).remove( key ) != null;
boolean removed = context.removeLocal( key );
if ( trace ) LOG.tracef( "Key %s removed from context: %s", key, removed );
}
else {
Expand All @@ -93,4 +91,5 @@ public void execute(Runnable runnable) {
runnable.run();
}
}

}

This file was deleted.

Loading