From 297cb9335b5ff3e95b060e5f4a61572b82b2a8ae Mon Sep 17 00:00:00 2001 From: Georgios Andrianakis Date: Thu, 25 Aug 2022 14:50:54 +0300 Subject: [PATCH] Don't clear our CDI current request when suspending This used to be done in order to prevent subsequent requests running on the same thread as a suspended request from accessing the former's data. With the advent of DuplicatedContext backed storage, there is no longer any chance of mixing data so there is no need to clear it out. Furthermore, by not clearing out current request, code that accesses the request scoped CurrentVertxRequest that is executed while the request is suspended, can now work even if context propagation is not in play. --- .../runtime/QuarkusResteasyReactiveRequestContext.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/extensions/resteasy-reactive/quarkus-resteasy-reactive/runtime/src/main/java/io/quarkus/resteasy/reactive/server/runtime/QuarkusResteasyReactiveRequestContext.java b/extensions/resteasy-reactive/quarkus-resteasy-reactive/runtime/src/main/java/io/quarkus/resteasy/reactive/server/runtime/QuarkusResteasyReactiveRequestContext.java index fb47a5faf78e4a..9ca38e98e49421 100644 --- a/extensions/resteasy-reactive/quarkus-resteasy-reactive/runtime/src/main/java/io/quarkus/resteasy/reactive/server/runtime/QuarkusResteasyReactiveRequestContext.java +++ b/extensions/resteasy-reactive/quarkus-resteasy-reactive/runtime/src/main/java/io/quarkus/resteasy/reactive/server/runtime/QuarkusResteasyReactiveRequestContext.java @@ -45,6 +45,13 @@ protected void handleRequestScopeActivation() { } } + @Override + protected void requestScopeDeactivated() { + // we intentionally don't call 'CurrentRequestManager.set(null)' + // because there is no need to clear the current request + // as that is backed by a DuplicatedContext and not accessible to other requests anyway + } + protected SecurityContext createSecurityContext() { return new ResteasyReactiveSecurityContext(context); }