Skip to content

Commit

Permalink
Don't clear our CDI current request when suspending
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
geoand authored and mkouba committed Aug 26, 2022
1 parent 67ca677 commit 297cb93
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 297cb93

Please sign in to comment.