From 6b30485e27491accf959b30f5c03a0b44ce38f83 Mon Sep 17 00:00:00 2001 From: Martin Kouba Date: Wed, 2 Aug 2023 18:47:47 +0200 Subject: [PATCH] Vertx: add priority to the SafeVertxContextInterceptor - also move the SafeVertxContext binding to the io.quarkus.vertx package because io.quarkus.vertx.core.runtime.context should not be considered part of the public API - fixes #35173 --- docs/src/main/asciidoc/duplicated-context.adoc | 2 +- .../java/io/quarkus/vertx/locals/SafeVertxContextTest.java | 2 +- .../vertx/{core/runtime/context => }/SafeVertxContext.java | 2 +- .../core/runtime/context/SafeVertxContextInterceptor.java | 5 +++++ 4 files changed, 8 insertions(+), 3 deletions(-) rename extensions/vertx/runtime/src/main/java/io/quarkus/vertx/{core/runtime/context => }/SafeVertxContext.java (96%) diff --git a/docs/src/main/asciidoc/duplicated-context.adoc b/docs/src/main/asciidoc/duplicated-context.adoc index d92f1840a5b24c..bb90a8a5811dfa 100644 --- a/docs/src/main/asciidoc/duplicated-context.adoc +++ b/docs/src/main/asciidoc/duplicated-context.adoc @@ -183,7 +183,7 @@ context can have spans in which it's safe, followed by spans in which it's not s To mark a context as safe, you can: -1. Use the `io.quarkus.vertx.core.runtime.context.SafeVertxContext` annotation +1. Use the `io.quarkus.vertx.SafeVertxContext` annotation 2. Use the `io.quarkus.vertx.core.runtime.context.VertxContextSafetyToggle` class By using the `io.quarkus.vertx.core.runtime.context.VertxContextSafetyToggle` class, the current context can be explicitly marked as `safe`, or it can be explicitly marked as `unsafe`; there's a third state which is the default of any new context: `unmarked`. diff --git a/extensions/vertx/deployment/src/test/java/io/quarkus/vertx/locals/SafeVertxContextTest.java b/extensions/vertx/deployment/src/test/java/io/quarkus/vertx/locals/SafeVertxContextTest.java index 26cbd637a8885f..51e0f10fd821f9 100644 --- a/extensions/vertx/deployment/src/test/java/io/quarkus/vertx/locals/SafeVertxContextTest.java +++ b/extensions/vertx/deployment/src/test/java/io/quarkus/vertx/locals/SafeVertxContextTest.java @@ -16,7 +16,7 @@ import org.junit.jupiter.api.extension.RegisterExtension; import io.quarkus.test.QuarkusUnitTest; -import io.quarkus.vertx.core.runtime.context.SafeVertxContext; +import io.quarkus.vertx.SafeVertxContext; import io.quarkus.vertx.core.runtime.context.VertxContextSafetyToggle; import io.smallrye.common.vertx.VertxContext; import io.vertx.core.Context; diff --git a/extensions/vertx/runtime/src/main/java/io/quarkus/vertx/core/runtime/context/SafeVertxContext.java b/extensions/vertx/runtime/src/main/java/io/quarkus/vertx/SafeVertxContext.java similarity index 96% rename from extensions/vertx/runtime/src/main/java/io/quarkus/vertx/core/runtime/context/SafeVertxContext.java rename to extensions/vertx/runtime/src/main/java/io/quarkus/vertx/SafeVertxContext.java index ebb833c8c2b2f7..ee3eaa1269b12b 100644 --- a/extensions/vertx/runtime/src/main/java/io/quarkus/vertx/core/runtime/context/SafeVertxContext.java +++ b/extensions/vertx/runtime/src/main/java/io/quarkus/vertx/SafeVertxContext.java @@ -1,4 +1,4 @@ -package io.quarkus.vertx.core.runtime.context; +package io.quarkus.vertx; import java.lang.annotation.ElementType; import java.lang.annotation.Inherited; diff --git a/extensions/vertx/runtime/src/main/java/io/quarkus/vertx/core/runtime/context/SafeVertxContextInterceptor.java b/extensions/vertx/runtime/src/main/java/io/quarkus/vertx/core/runtime/context/SafeVertxContextInterceptor.java index 2f049a386ac3c5..91fc1e15112556 100644 --- a/extensions/vertx/runtime/src/main/java/io/quarkus/vertx/core/runtime/context/SafeVertxContextInterceptor.java +++ b/extensions/vertx/runtime/src/main/java/io/quarkus/vertx/core/runtime/context/SafeVertxContextInterceptor.java @@ -1,5 +1,8 @@ package io.quarkus.vertx.core.runtime.context; +import static jakarta.interceptor.Interceptor.Priority.PLATFORM_BEFORE; + +import jakarta.annotation.Priority; import jakarta.inject.Inject; import jakarta.interceptor.AroundInvoke; import jakarta.interceptor.Interceptor; @@ -7,9 +10,11 @@ import org.jboss.logging.Logger; import io.quarkus.arc.ArcInvocationContext; +import io.quarkus.vertx.SafeVertxContext; import io.vertx.core.Vertx; @SafeVertxContext +@Priority(PLATFORM_BEFORE) @Interceptor public class SafeVertxContextInterceptor {