Skip to content

Commit

Permalink
Make sure that management router is reloaded
Browse files Browse the repository at this point in the history
  • Loading branch information
marko-bekhta committed Jun 21, 2024
1 parent ed77ee2 commit 47b5eda
Showing 1 changed file with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ private boolean uriValid(HttpServerRequest httpServerRequest) {

final RuntimeValue<ManagementInterfaceConfiguration> managementConfiguration;
private static volatile Handler<HttpServerRequest> managementRouter;
private static volatile Handler<HttpServerRequest> managementRouterDelegate;

public VertxHttpRecorder(HttpBuildTimeConfig httpBuildTimeConfig,
ManagementInterfaceBuildTimeConfig managementBuildTimeConfig,
Expand Down Expand Up @@ -546,6 +547,19 @@ public void handle(RoutingContext event) {
// Add body handler and cors handler
var mr = managementRouter.getValue();

if (hotReplacementHandler != null) {
//recorders are always executed in the current CL
ClassLoader currentCl = Thread.currentThread().getContextClassLoader();
mr.route().order(RouteConstants.ROUTE_ORDER_HOT_REPLACEMENT)
.handler(new Handler<RoutingContext>() {
@Override
public void handle(RoutingContext event) {
Thread.currentThread().setContextClassLoader(currentCl);
hotReplacementHandler.handle(event);
}
});
}

mr.route().last().failureHandler(
new QuarkusErrorHandler(launchMode.isDevOrTest(), httpConfiguration.unhandledErrorContentTypeDefault));

Expand All @@ -567,7 +581,8 @@ public void handle(RoutingContext event) {

event.select(ManagementInterface.class).fire(new ManagementInterfaceImpl(managementRouter.getValue()));

VertxHttpRecorder.managementRouter = handler;
VertxHttpRecorder.managementRouterDelegate = handler;
VertxHttpRecorder.managementRouter = e -> VertxHttpRecorder.managementRouterDelegate.handle(e);
}
}

Expand Down

0 comments on commit 47b5eda

Please sign in to comment.