JooHyukKim commented on code in PR #20713:
URL: https://github.com/apache/pulsar/pull/20713#discussion_r1251977828


##########
pulsar-broker-common/src/main/java/org/apache/pulsar/broker/ServiceConfigurationUtils.java:
##########
@@ -137,4 +137,18 @@ public static String webServiceUrl(String host, int port) {
     public static String webServiceUrlTls(String host, int port) {
         return String.format("https://%s:%d";, host, port);
     }
+
+    public static long getLongPropertyOrDefault(ServiceConfiguration config, 
String key, long defaultValue) {
+        Object value = config.getProperties().get(key);
+        if (value instanceof Integer) {
+            return (Long) value;
+        } else if (value instanceof String) {
+            try {
+                return Long.parseLong((String) value);
+            } catch (NumberFormatException e) {
+                return defaultValue;
+            }
+        }
+        return defaultValue;
+    }

Review Comment:
   My review was only valid when line 143 was instance of Integer. NP now 👍🏻👍🏻
   
   ```java
   if (value instanceof Integer) {
   ```



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to