Skip to content

Commit b09d6a3

Browse files
committed
Temp fix for ContextLocal
I still have to remove the deprecated methods
1 parent 51372f1 commit b09d6a3

File tree

3 files changed

+6
-11
lines changed

3 files changed

+6
-11
lines changed

hibernate-reactive-core/src/main/java/org/hibernate/reactive/context/Context.java

+2-3
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
import java.util.concurrent.Executor;
1111

12-
import io.vertx.core.spi.context.storage.ContextLocal;
1312

1413
/**
1514
* Abstracts away from the Vert.x {@link io.vertx.core.Context}
@@ -46,7 +45,7 @@ public interface Context extends Executor, Service {
4645
* context is created.
4746
*/
4847
@Override
49-
void execute(Runnable runnable);
48+
void execute(Runnable runable);
5049

5150
/**
5251
* An object that identifies something we store in the Vert.x
@@ -55,5 +54,5 @@ public interface Context extends Executor, Service {
5554
*
5655
* @param <T> the type of thing we're storing in the context
5756
*/
58-
interface Key<T> extends ContextLocal<T> {}
57+
interface Key<T> {}
5958
}

hibernate-reactive-core/src/main/java/org/hibernate/reactive/context/impl/VertxContext.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ public <T> void put(Key<T> key, T instance) {
3939
final ContextInternal context = currentContext();
4040
if ( context != null ) {
4141
if ( trace ) LOG.tracef( "Putting key,value in context: [%1$s, %2$s]", key, instance );
42-
context.putLocal( );
4342
context.putLocal( key, instance );
4443
}
4544
else {
@@ -88,6 +87,7 @@ public void execute(Runnable runnable) {
8887
// that could lead to unintentionally share the same session with other streams.
8988
ContextInternal newContextInternal = (ContextInternal) newContext;
9089
final ContextInternal duplicate = newContextInternal.duplicate();
90+
9191
if ( trace ) LOG.tracef( "Using duplicated context from VertxInstance: %s", duplicate );
9292
duplicate.runOnContext( x -> runnable.run() );
9393
}

hibernate-reactive-core/src/test/java/org/hibernate/reactive/schema/SchemaValidationTest.java

+3-7
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
import static org.hibernate.reactive.containers.DatabaseConfiguration.DBType.DB2;
3535
import static org.hibernate.reactive.containers.DatabaseConfiguration.DBType.MARIA;
3636
import static org.hibernate.reactive.containers.DatabaseConfiguration.DBType.MYSQL;
37+
import static org.hibernate.reactive.testing.ReactiveAssertions.assertThrown;
3738
import static org.hibernate.tool.schema.JdbcMetadaAccessStrategy.GROUPED;
3839
import static org.hibernate.tool.schema.JdbcMetadaAccessStrategy.INDIVIDUALLY;
3940
import static org.junit.jupiter.params.provider.Arguments.arguments;
@@ -126,13 +127,8 @@ context, setupFactory( strategy, type )
126127
validateConf.addAnnotatedClass( BasicTypesTestEntity.class );
127128
// The table mapping this entity shouldn't be in the db
128129
validateConf.addAnnotatedClass( Extra.class );
129-
return setupSessionFactory( validateConf )
130-
.handle( (unused, throwable) -> {
131-
assertThat( throwable )
132-
.isInstanceOf( SchemaManagementException.class )
133-
.hasMessage( errorMessage );
134-
return null;
135-
} );
130+
return assertThrown( SchemaManagementException.class, setupSessionFactory( validateConf ) )
131+
.thenAccept( throwable -> assertThat( throwable ).hasMessage( errorMessage ) );
136132
} )
137133
);
138134
}

0 commit comments

Comments
 (0)