diff --git a/extensions/arc/runtime/src/main/java/io/quarkus/arc/runtime/devui/ArcJsonRPCService.java b/extensions/arc/runtime/src/main/java/io/quarkus/arc/runtime/devui/ArcJsonRPCService.java index f3f4143017da5..4b125b56a1872 100644 --- a/extensions/arc/runtime/src/main/java/io/quarkus/arc/runtime/devui/ArcJsonRPCService.java +++ b/extensions/arc/runtime/src/main/java/io/quarkus/arc/runtime/devui/ArcJsonRPCService.java @@ -13,6 +13,7 @@ import io.quarkus.arc.runtime.devmode.EventInfo; import io.quarkus.arc.runtime.devmode.EventsMonitor; import io.quarkus.arc.runtime.devmode.InvocationInfo; +import io.smallrye.common.annotation.NonBlocking; import io.smallrye.mutiny.Multi; public class ArcJsonRPCService { @@ -25,6 +26,7 @@ public Multi streamEvents() { return Multi.createFrom().empty(); } + @NonBlocking public List getLastEvents() { EventsMonitor eventsMonitor = Arc.container().instance(EventsMonitor.class).get(); if (eventsMonitor != null) { @@ -33,6 +35,7 @@ public List getLastEvents() { return List.of(); } + @NonBlocking public List clearLastEvents() { EventsMonitor eventsMonitor = Arc.container().instance(EventsMonitor.class).get(); if (eventsMonitor != null) { @@ -42,6 +45,7 @@ public List clearLastEvents() { return List.of(); } + @NonBlocking public List getLastInvocations() { InvocationsMonitor invocationsMonitor = Arc.container().instance(InvocationsMonitor.class).get(); if (invocationsMonitor != null) { @@ -51,6 +55,7 @@ public List getLastInvocations() { return List.of(); } + @NonBlocking public List clearLastInvocations() { InvocationsMonitor invocationsMonitor = Arc.container().instance(InvocationsMonitor.class).get(); if (invocationsMonitor != null) { diff --git a/extensions/cache/runtime/src/main/java/io/quarkus/cache/runtime/devconsole/CacheJsonRPCService.java b/extensions/cache/runtime/src/main/java/io/quarkus/cache/runtime/devconsole/CacheJsonRPCService.java index 3bf4cfcc74384..898341226909d 100644 --- a/extensions/cache/runtime/src/main/java/io/quarkus/cache/runtime/devconsole/CacheJsonRPCService.java +++ b/extensions/cache/runtime/src/main/java/io/quarkus/cache/runtime/devconsole/CacheJsonRPCService.java @@ -15,6 +15,8 @@ import io.quarkus.cache.CacheManager; import io.quarkus.cache.CaffeineCache; import io.quarkus.cache.runtime.caffeine.CaffeineCacheImpl; +import io.smallrye.common.annotation.NonBlocking; +import io.smallrye.mutiny.Uni; import io.vertx.core.json.JsonArray; import io.vertx.core.json.JsonObject; @@ -27,6 +29,7 @@ public class CacheJsonRPCService { @Inject Logger logger; + @NonBlocking public JsonArray getAll() { Collection names = manager.getCacheNames(); List allCaches = new ArrayList<>(names.size()); @@ -49,17 +52,16 @@ private JsonObject getJsonRepresentationForCache(Cache cc) { return new JsonObject().put("name", cc.getName()).put("size", ((CaffeineCacheImpl) cc).getSize()); } - public JsonObject clear(String name) { + public Uni clear(String name) { Optional cache = manager.getCache(name); if (cache.isPresent()) { - cache.get().invalidateAll().subscribe().asCompletionStage() - .thenAccept(x -> logger.infof("Cache %s cleared", name)); - return getJsonRepresentationForCache(cache.get()); + return cache.get().invalidateAll().map((t) -> getJsonRepresentationForCache(cache.get())); } else { - return new JsonObject().put("name", name).put("size", -1); + return Uni.createFrom().item(new JsonObject().put("name", name).put("size", -1)); } } + @NonBlocking public JsonObject refresh(String name) { Optional cache = manager.getCache(name); if (cache.isPresent()) { diff --git a/extensions/resteasy-reactive/quarkus-resteasy-reactive/runtime/src/main/java/io/quarkus/resteasy/reactive/server/runtime/devui/ResteasyReactiveJsonRPCService.java b/extensions/resteasy-reactive/quarkus-resteasy-reactive/runtime/src/main/java/io/quarkus/resteasy/reactive/server/runtime/devui/ResteasyReactiveJsonRPCService.java index 4bb83fe8018de..b04e555d7eafa 100644 --- a/extensions/resteasy-reactive/quarkus-resteasy-reactive/runtime/src/main/java/io/quarkus/resteasy/reactive/server/runtime/devui/ResteasyReactiveJsonRPCService.java +++ b/extensions/resteasy-reactive/quarkus-resteasy-reactive/runtime/src/main/java/io/quarkus/resteasy/reactive/server/runtime/devui/ResteasyReactiveJsonRPCService.java @@ -11,11 +11,13 @@ import org.jboss.resteasy.reactive.server.util.ScoreSystem; import io.quarkus.resteasy.reactive.server.runtime.ResteasyReactiveRecorder; +import io.smallrye.common.annotation.NonBlocking; import io.vertx.core.json.JsonArray; import io.vertx.core.json.JsonObject; public class ResteasyReactiveJsonRPCService { + @NonBlocking public JsonObject getEndpointScores() { JsonObject endpointScore = new JsonObject(); @@ -62,6 +64,7 @@ public JsonObject getEndpointScores() { return endpointScore; } + @NonBlocking public JsonArray getExceptionMappers() { JsonArray all = new JsonArray(); var mappers = RuntimeExceptionMapper.getMappers(); @@ -75,6 +78,7 @@ public JsonArray getExceptionMappers() { return all; } + @NonBlocking public JsonArray getParamConverterProviders() { JsonArray all = new JsonArray(); var providers = ResteasyReactiveRecorder.getCurrentDeployment().getParamConverterProviders() diff --git a/extensions/scheduler/runtime/src/main/java/io/quarkus/scheduler/runtime/devui/SchedulerJsonRPCService.java b/extensions/scheduler/runtime/src/main/java/io/quarkus/scheduler/runtime/devui/SchedulerJsonRPCService.java index 8cb1c98a95f20..cde1a07f4f5a3 100644 --- a/extensions/scheduler/runtime/src/main/java/io/quarkus/scheduler/runtime/devui/SchedulerJsonRPCService.java +++ b/extensions/scheduler/runtime/src/main/java/io/quarkus/scheduler/runtime/devui/SchedulerJsonRPCService.java @@ -24,6 +24,7 @@ import io.quarkus.scheduler.common.runtime.SchedulerContext; import io.quarkus.scheduler.common.runtime.util.SchedulerUtils; import io.quarkus.vertx.core.runtime.context.VertxContextSafetyToggle; +import io.smallrye.common.annotation.NonBlocking; import io.smallrye.common.vertx.VertxContext; import io.smallrye.mutiny.Multi; import io.smallrye.mutiny.operators.multi.processors.BroadcastProcessor; @@ -86,6 +87,7 @@ public Multi streamRunningStatus() { return runningStatus; } + @NonBlocking public JsonObject getData() { SchedulerContext c = context.get(); Scheduler s = scheduler.get(); @@ -127,6 +129,7 @@ public JsonObject getData() { return ret; } + @NonBlocking public JsonObject pauseScheduler() { Scheduler s = scheduler.get(); if (!s.isRunning()) { @@ -137,6 +140,7 @@ public JsonObject pauseScheduler() { return newSuccess("Scheduler was paused"); } + @NonBlocking public JsonObject resumeScheduler() { Scheduler s = scheduler.get(); if (s.isRunning()) { @@ -147,6 +151,7 @@ public JsonObject resumeScheduler() { return newSuccess("Scheduler was resumed"); } + @NonBlocking public JsonObject pauseJob(String identity) { Scheduler s = scheduler.get(); if (s.isPaused(identity)) { @@ -157,6 +162,7 @@ public JsonObject pauseJob(String identity) { return newSuccess("Job with identity " + identity + " was paused"); } + @NonBlocking public JsonObject resumeJob(String identity) { Scheduler s = scheduler.get(); if (!s.isPaused(identity)) { @@ -167,6 +173,7 @@ public JsonObject resumeJob(String identity) { return newSuccess("Job with identity " + identity + " was resumed"); } + @NonBlocking public JsonObject executeJob(String methodDescription) { SchedulerContext c = context.get(); for (ScheduledMethod metadata : c.getScheduledMethods()) { diff --git a/extensions/vertx-http/deployment/src/main/java/io/quarkus/vertx/http/deployment/devmode/console/ConfigEditorProcessor.java b/extensions/vertx-http/deployment/src/main/java/io/quarkus/vertx/http/deployment/devmode/console/ConfigEditorProcessor.java index fc28b82441960..46a967c116d45 100644 --- a/extensions/vertx-http/deployment/src/main/java/io/quarkus/vertx/http/deployment/devmode/console/ConfigEditorProcessor.java +++ b/extensions/vertx-http/deployment/src/main/java/io/quarkus/vertx/http/deployment/devmode/console/ConfigEditorProcessor.java @@ -44,7 +44,7 @@ import io.quarkus.devconsole.runtime.spi.DevConsolePostHandler; import io.quarkus.devconsole.spi.DevConsoleRouteBuildItem; import io.quarkus.devconsole.spi.DevConsoleRuntimeTemplateInfoBuildItem; -import io.quarkus.devui.runtime.ConfigJsonRpcService; +import io.quarkus.devui.runtime.config.ConfigJsonRpcService; import io.quarkus.devui.spi.JsonRPCProvidersBuildItem; import io.quarkus.vertx.http.runtime.devmode.ConfigDescription; import io.quarkus.vertx.http.runtime.devmode.ConfigDescriptionsManager; diff --git a/extensions/vertx-http/runtime/src/main/java/io/quarkus/devui/runtime/ConfigJsonRpcService.java b/extensions/vertx-http/runtime/src/main/java/io/quarkus/devui/runtime/config/ConfigJsonRpcService.java similarity index 89% rename from extensions/vertx-http/runtime/src/main/java/io/quarkus/devui/runtime/ConfigJsonRpcService.java rename to extensions/vertx-http/runtime/src/main/java/io/quarkus/devui/runtime/config/ConfigJsonRpcService.java index d344840787698..0369cb62db578 100644 --- a/extensions/vertx-http/runtime/src/main/java/io/quarkus/devui/runtime/ConfigJsonRpcService.java +++ b/extensions/vertx-http/runtime/src/main/java/io/quarkus/devui/runtime/config/ConfigJsonRpcService.java @@ -1,4 +1,4 @@ -package io.quarkus.devui.runtime; +package io.quarkus.devui.runtime.config; import java.util.Map; @@ -14,7 +14,6 @@ public class ConfigJsonRpcService { public boolean updateProperty(String name, String value) { - System.out.println("setting " + name + " to " + value); DevConsoleManager.invoke("config-update-property", Map.of("name", name, "value", value)); return true; } @@ -27,5 +26,4 @@ public JsonObject getAllValues() { } return values; } - } diff --git a/extensions/vertx-http/runtime/src/main/java/io/quarkus/devui/runtime/logstream/LogStreamJsonRPCService.java b/extensions/vertx-http/runtime/src/main/java/io/quarkus/devui/runtime/logstream/LogStreamJsonRPCService.java index 425d3f8b810ec..76ac2b2b561e1 100644 --- a/extensions/vertx-http/runtime/src/main/java/io/quarkus/devui/runtime/logstream/LogStreamJsonRPCService.java +++ b/extensions/vertx-http/runtime/src/main/java/io/quarkus/devui/runtime/logstream/LogStreamJsonRPCService.java @@ -5,6 +5,7 @@ import java.util.concurrent.LinkedBlockingQueue; import io.quarkus.arc.Arc; +import io.smallrye.common.annotation.NonBlocking; import io.smallrye.mutiny.Multi; import io.vertx.core.json.JsonObject; @@ -13,10 +14,12 @@ */ public class LogStreamJsonRPCService { + @NonBlocking public String ping() { return "pong"; } + @NonBlocking public List history() { LogStreamBroadcaster logStreamBroadcaster = Arc.container().instance(LogStreamBroadcaster.class).get(); LinkedBlockingQueue history = logStreamBroadcaster.getHistory();