File tree Expand file tree Collapse file tree 5 files changed +46
-4
lines changed
deployment/src/main/java/io/quarkus/vertx/web/deployment
runtime/src/main/java/io/quarkus/vertx/web/runtime
independent-projects/arc/runtime/src/main/java/io/quarkus/arc/impl Expand file tree Collapse file tree 5 files changed +46
-4
lines changed Original file line number Diff line number Diff line change 5959import io .quarkus .deployment .annotations .Record ;
6060import io .quarkus .deployment .builditem .FeatureBuildItem ;
6161import io .quarkus .deployment .builditem .GeneratedClassBuildItem ;
62+ import io .quarkus .deployment .builditem .ShutdownContextBuildItem ;
6263import io .quarkus .deployment .builditem .nativeimage .ReflectiveClassBuildItem ;
6364import io .quarkus .deployment .util .HashUtil ;
6465import io .quarkus .gizmo .AssignableResultHandle ;
@@ -211,7 +212,8 @@ void addAdditionalRoutes(
211212 BuildProducer <RouteBuildItem > routeProducer ,
212213 BuildProducer <FilterBuildItem > filterProducer ,
213214 List <RequireBodyHandlerBuildItem > bodyHandlerRequired ,
214- BeanArchiveIndexBuildItem beanArchive ) throws IOException {
215+ BeanArchiveIndexBuildItem beanArchive ,
216+ ShutdownContextBuildItem shutdown ) throws IOException {
215217
216218 ClassOutput classOutput = new GeneratedClassGizmoAdaptor (generatedClass , true );
217219 IndexView index = beanArchive .getIndex ();
@@ -326,6 +328,8 @@ void addAdditionalRoutes(
326328 }
327329
328330 detectConflictingRoutes (matchers );
331+
332+ recorder .clearCacheOnShutdown (shutdown );
329333 }
330334
331335 @ BuildStep
Original file line number Diff line number Diff line change @@ -28,14 +28,14 @@ default void handle(RoutingContext context) {
2828 //todo: how should we handle non-proactive authentication here?
2929 if (requestContext .isActive ()) {
3030 if (user != null ) {
31- Arc . container (). beanManager (). fireEvent (user .getSecurityIdentity ());
31+ RouteHandlers . fireSecurityIdentity (user .getSecurityIdentity ());
3232 }
3333 invoke (context );
3434 } else {
3535 try {
3636 requestContext .activate ();
3737 if (user != null ) {
38- Arc . container (). beanManager (). fireEvent (user .getSecurityIdentity ());
38+ RouteHandlers . fireSecurityIdentity (user .getSecurityIdentity ());
3939 }
4040 invoke (context );
4141 } finally {
Original file line number Diff line number Diff line change 1+ package io .quarkus .vertx .web .runtime ;
2+
3+ import javax .enterprise .event .Event ;
4+
5+ import io .quarkus .arc .Arc ;
6+ import io .quarkus .arc .impl .LazyValue ;
7+ import io .quarkus .security .identity .SecurityIdentity ;
8+
9+ final class RouteHandlers {
10+
11+ private static final LazyValue <Event <SecurityIdentity >> SECURITY_IDENTITY_EVENT = new LazyValue <>(
12+ RouteHandlers ::createEvent );
13+
14+ static void fireSecurityIdentity (SecurityIdentity identity ) {
15+ SECURITY_IDENTITY_EVENT .get ().fire (identity );
16+ }
17+
18+ static void clear () {
19+ SECURITY_IDENTITY_EVENT .clear ();
20+ }
21+
22+ private static Event <SecurityIdentity > createEvent () {
23+ return Arc .container ().beanManager ().getEvent ().select (SecurityIdentity .class );
24+ }
25+
26+ }
Original file line number Diff line number Diff line change 33import java .lang .reflect .InvocationTargetException ;
44import java .util .function .Function ;
55
6+ import io .quarkus .runtime .ShutdownContext ;
67import io .quarkus .runtime .annotations .Recorder ;
78import io .quarkus .vertx .http .runtime .RouterProducer ;
89import io .vertx .core .Handler ;
@@ -69,4 +70,13 @@ public io.vertx.ext.web.Route apply(Router router) {
6970 };
7071 }
7172
73+ public void clearCacheOnShutdown (ShutdownContext shutdown ) {
74+ shutdown .addShutdownTask (new Runnable () {
75+ @ Override
76+ public void run () {
77+ RouteHandlers .clear ();
78+ }
79+ });
80+ }
81+
7282}
Original file line number Diff line number Diff line change @@ -121,7 +121,9 @@ public void validate(InjectionPoint injectionPoint) {
121121
122122 @ Override
123123 public void fireEvent (Object event , Annotation ... qualifiers ) {
124- getEvent ().select (qualifiers ).fire (event );
124+ Set <Annotation > eventQualifiers = new HashSet <>();
125+ Collections .addAll (eventQualifiers , qualifiers );
126+ new EventImpl <Object >(event .getClass (), eventQualifiers ).fire (event );
125127 }
126128
127129 @ Override
You can’t perform that action at this time.
0 commit comments