Skip to content

Commit 54414d1

Browse files
committed
[#2234] Revert "[#2176] Create custom Vert.x contextual data storage"
This reverts commit b4ab6a4.
1 parent ab6aa32 commit 54414d1

File tree

3 files changed

+4
-40
lines changed

3 files changed

+4
-40
lines changed

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

Lines changed: 0 additions & 25 deletions
This file was deleted.

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

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,9 @@
66
package org.hibernate.reactive.context.impl;
77

88
import java.lang.invoke.MethodHandles;
9-
import java.util.concurrent.ConcurrentHashMap;
10-
import java.util.concurrent.ConcurrentMap;
119

1210
import io.vertx.core.Vertx;
1311
import io.vertx.core.impl.ContextInternal;
14-
import io.vertx.core.spi.context.storage.AccessMode;
1512

1613
import org.hibernate.reactive.context.Context;
1714
import org.hibernate.reactive.logging.impl.Log;
@@ -42,7 +39,7 @@ public <T> void put(Key<T> key, T instance) {
4239
final ContextInternal context = ContextInternal.current();
4340
if ( context != null ) {
4441
if ( trace ) LOG.tracef( "Putting key,value in context: [%1$s, %2$s]", key, instance );
45-
VertxContext.<T>contextualDataMap( context ).put( key, instance );
42+
context.localContextData().put( key, instance );
4643
}
4744
else {
4845
if ( trace ) LOG.tracef( "Context is null for key,value: [%1$s, %2$s]", key, instance );
@@ -54,7 +51,8 @@ public <T> void put(Key<T> key, T instance) {
5451
public <T> T get(Key<T> key) {
5552
final ContextInternal context = ContextInternal.current();
5653
if ( context != null ) {
57-
T local = VertxContext.<T>contextualDataMap( context ).get( key );
54+
@SuppressWarnings("unchecked")
55+
T local = (T) context.localContextData().get( key );
5856
if ( trace ) LOG.tracef( "Getting value %2$s from context for key %1$s", key, local );
5957
return local;
6058
}
@@ -68,7 +66,7 @@ public <T> T get(Key<T> key) {
6866
public void remove(Key<?> key) {
6967
final ContextInternal context = ContextInternal.current();
7068
if ( context != null ) {
71-
boolean removed = contextualDataMap( context ).remove( key ) != null;
69+
boolean removed = context.localContextData().remove( key ) != null;
7270
if ( trace ) LOG.tracef( "Key %s removed from context: %s", key, removed );
7371
}
7472
else {
@@ -95,12 +93,4 @@ public void execute(Runnable runnable) {
9593
}
9694
}
9795

98-
@SuppressWarnings({ "unchecked" })
99-
private static <T> ConcurrentMap<Key<T>, T> contextualDataMap(ContextInternal vertxContext) {
100-
return vertxContext.getLocal(
101-
ContextualDataStorage.CONTEXTUAL_DATA_KEY,
102-
AccessMode.CONCURRENT,
103-
ConcurrentHashMap::new
104-
);
105-
}
10696
}

hibernate-reactive-core/src/main/resources/META-INF/services/io.vertx.core.spi.VertxServiceProvider

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)