You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2022/02/07 03:29:06 UTC

[GitHub] [pulsar] nodece commented on a change in pull request #14087: Make ``BrokerBase#updateDynamicConfiguration`` pure async.

nodece commented on a change in pull request #14087:
URL: https://github.com/apache/pulsar/pull/14087#discussion_r800293940



##########
File path: pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/BrokersBase.java
##########
@@ -168,10 +168,19 @@ public void getLeaderBroker(@Suspended final AsyncResponse asyncResponse) {
             @ApiResponse(code = 404, message = "Configuration not found"),
             @ApiResponse(code = 412, message = "Invalid dynamic-config value"),
             @ApiResponse(code = 500, message = "Internal server error") })
-    public void updateDynamicConfiguration(@PathParam("configName") String configName,
-                                           @PathParam("configValue") String configValue) throws Exception {
-        validateSuperUserAccess();
-        persistDynamicConfiguration(configName, configValue);
+    public void updateDynamicConfiguration(@Suspended AsyncResponse asyncResponse,
+                                           @PathParam("configName") String configName,
+                                           @PathParam("configValue") String configValue) {
+        validateSuperUserAccessAsync()
+                .thenCompose(__ -> persistDynamicConfiguration(configName, configValue))
+                .thenAccept(__ -> {
+                    LOG.info("[{}] Updated Service configuration {}/{}", clientAppId(), configName, configValue);
+                    asyncResponse.resume(Response.ok().build());
+                }).exceptionally(ex -> {
+                    LOG.error("[{}] Failed to update configuration {}/{}, {}", clientAppId(), configName, configValue,

Review comment:
       ```suggestion
                       LOG.error("[{}] Failed to update configuration {}/{}", clientAppId(), configName, configValue, ex);
   ```




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org