You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by "mattisonchao (via GitHub)" <gi...@apache.org> on 2023/12/11 00:28:41 UTC
Re: [PR] [improve][broker] PIP-300: Add custom dynamic configuration for plugins [pulsar]
mattisonchao commented on code in PR #20884:
URL: https://github.com/apache/pulsar/pull/20884#discussion_r1421850337
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/BrokerService.java:
##########
@@ -2514,22 +2514,26 @@ private void handleDynamicConfigurationUpdates() {
return;
}
Field configField = configFieldWrapper.field;
- Object newValue = FieldParser.value(data.get(configKey), configField);
- if (configField != null) {
- Consumer listener = configRegisteredListeners.get(configKey);
- try {
- Object existingValue = configField.get(pulsar.getConfiguration());
+ Consumer listener = configRegisteredListeners.get(configKey);
+ Object newValue = null;
+ Object existingValue;
+
+ try {
+ if (configField != null) {
+ newValue = FieldParser.value(data.get(configKey), configField);
+ existingValue = configField.get(pulsar.getConfiguration());
configField.set(pulsar.getConfiguration(), newValue);
- log.info("Successfully updated configuration {}/{}", configKey,
- data.get(configKey));
- if (listener != null && !existingValue.equals(newValue)) {
- listener.accept(newValue);
- }
- } catch (Exception e) {
- log.error("Failed to update config {}/{}", configKey, newValue);
+ } else {
+ newValue = value;
+ existingValue = configFieldWrapper.customValue;
Review Comment:
what if `customValue` equals null?
--
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