Skip to content

Commit a65ae49

Browse files
SanneDavideD
authored andcommitted
Take advantage of the Vert.x Context API improvements
1 parent b741fc9 commit a65ae49

File tree

1 file changed

+6
-10
lines changed
  • hibernate-reactive-core/src/main/java/org/hibernate/reactive/context/impl

1 file changed

+6
-10
lines changed

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

+6-10
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,11 @@ public void injectServices(ServiceRegistryImplementor serviceRegistry) {
3232
vertxInstance = serviceRegistry.getService( VertxInstance.class );
3333
}
3434

35-
static ContextInternal currentContext() {
36-
return (ContextInternal) Vertx.currentContext();
37-
}
38-
3935
@Override
4036
public <T> void put(Key<T> key, T instance) {
41-
final ContextInternal context = currentContext();
37+
final io.vertx.core.Context context = Vertx.currentContext();
4238
if ( context != null ) {
43-
context.localContextData().put( key, instance );
39+
context.put( key, instance );
4440
}
4541
else {
4642
throw LOG.notVertxContextActive();
@@ -50,9 +46,9 @@ public <T> void put(Key<T> key, T instance) {
5046
@Override
5147
@SuppressWarnings("unchecked")
5248
public <T> T get(Key<T> key) {
53-
final ContextInternal context = currentContext();
49+
final io.vertx.core.Context context = Vertx.currentContext();
5450
if ( context != null ) {
55-
return (T) context.localContextData().get( key );
51+
return (T) context.get( key );
5652
}
5753
else {
5854
return null;
@@ -61,9 +57,9 @@ public <T> T get(Key<T> key) {
6157

6258
@Override
6359
public void remove(Key<?> key) {
64-
final ContextInternal context = currentContext();
60+
final io.vertx.core.Context context = Vertx.currentContext();
6561
if ( context != null ) {
66-
context.localContextData().remove( key );
62+
context.remove( key );
6763
}
6864
}
6965

0 commit comments

Comments
 (0)