Skip to content

Commit

Permalink
Temp fix for ContextLocal
Browse files Browse the repository at this point in the history
I still have to remove the deprecated methods
  • Loading branch information
DavideD committed Feb 3, 2025
1 parent 51372f1 commit b09d6a3
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

import java.util.concurrent.Executor;

import io.vertx.core.spi.context.storage.ContextLocal;

/**
* Abstracts away from the Vert.x {@link io.vertx.core.Context}
Expand Down Expand Up @@ -46,7 +45,7 @@ public interface Context extends Executor, Service {
* context is created.
*/
@Override
void execute(Runnable runnable);
void execute(Runnable runable);

/**
* An object that identifies something we store in the Vert.x
Expand All @@ -55,5 +54,5 @@ public interface Context extends Executor, Service {
*
* @param <T> the type of thing we're storing in the context
*/
interface Key<T> extends ContextLocal<T> {}
interface Key<T> {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ public <T> void put(Key<T> key, T instance) {
final ContextInternal context = currentContext();
if ( context != null ) {
if ( trace ) LOG.tracef( "Putting key,value in context: [%1$s, %2$s]", key, instance );
context.putLocal( );
context.putLocal( key, instance );
}
else {
Expand Down Expand Up @@ -88,6 +87,7 @@ public void execute(Runnable runnable) {
// that could lead to unintentionally share the same session with other streams.
ContextInternal newContextInternal = (ContextInternal) newContext;
final ContextInternal duplicate = newContextInternal.duplicate();

if ( trace ) LOG.tracef( "Using duplicated context from VertxInstance: %s", duplicate );
duplicate.runOnContext( x -> runnable.run() );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import static org.hibernate.reactive.containers.DatabaseConfiguration.DBType.DB2;
import static org.hibernate.reactive.containers.DatabaseConfiguration.DBType.MARIA;
import static org.hibernate.reactive.containers.DatabaseConfiguration.DBType.MYSQL;
import static org.hibernate.reactive.testing.ReactiveAssertions.assertThrown;
import static org.hibernate.tool.schema.JdbcMetadaAccessStrategy.GROUPED;
import static org.hibernate.tool.schema.JdbcMetadaAccessStrategy.INDIVIDUALLY;
import static org.junit.jupiter.params.provider.Arguments.arguments;
Expand Down Expand Up @@ -126,13 +127,8 @@ context, setupFactory( strategy, type )
validateConf.addAnnotatedClass( BasicTypesTestEntity.class );
// The table mapping this entity shouldn't be in the db
validateConf.addAnnotatedClass( Extra.class );
return setupSessionFactory( validateConf )
.handle( (unused, throwable) -> {
assertThat( throwable )
.isInstanceOf( SchemaManagementException.class )
.hasMessage( errorMessage );
return null;
} );
return assertThrown( SchemaManagementException.class, setupSessionFactory( validateConf ) )
.thenAccept( throwable -> assertThat( throwable ).hasMessage( errorMessage ) );
} )
);
}
Expand Down

0 comments on commit b09d6a3

Please sign in to comment.