Copilot commented on code in PR #24790:
URL: https://github.com/apache/pulsar/pull/24790#discussion_r2384044893


##########
pulsar-common/src/main/java/org/apache/pulsar/common/util/netty/DnsResolverUtil.java:
##########
@@ -61,10 +61,7 @@ public class DnsResolverUtil {
                     .map(Integer::decode)
                     .filter(i -> i > 0)
                     .orElseGet(() -> {
-                        if (System.getSecurityManager() == null) {
-                            return JDK_DEFAULT_TTL;
-                        }
-                        return DEFAULT_TTL;
+                        return JDK_DEFAULT_TTL;

Review Comment:
   The removal of the security manager check simplifies the code, but the logic 
now always returns JDK_DEFAULT_TTL instead of DEFAULT_TTL when the security 
manager was present. This change may alter existing behavior for deployments 
using security managers.
   ```suggestion
                           // If a security manager is present, use 
DEFAULT_TTL; otherwise, use JDK_DEFAULT_TTL
                           return System.getSecurityManager() != null ? 
DEFAULT_TTL : JDK_DEFAULT_TTL;
   ```



##########
pulsar-common/src/main/java/org/apache/pulsar/common/util/netty/EventLoopUtil.java:
##########
@@ -96,6 +90,15 @@ public static EventLoopGroup newEventLoopGroup(int nThreads, 
boolean enableBusyW
         }
     }
 
+    private static boolean isIoUringEnabledAndAvailable() {
+        // By default, io_uring will not be enabled, even if available. The 
environment variable will be used:
+        // enable.io_uring=1
+        boolean ioUringEnabled = 
StringUtils.equalsAnyIgnoreCase(System.getProperty(ENABLE_IO_URING), "1", 
"true");
+        // Throw exception if IOUring cannot be used
+        IOUring.ensureAvailability();
+        return ioUringEnabled;

Review Comment:
   The method checks for IOUring availability regardless of whether it's 
enabled or not. The `IOUring.ensureAvailability()` call should only be made 
when `ioUringEnabled` is true to avoid unnecessary exceptions when IOUring is 
disabled but not available.
   ```suggestion
           if (!ioUringEnabled) {
               return false;
           }
           try {
               IOUring.ensureAvailability();
               return true;
           } catch (Throwable t) {
               return false;
           }
   ```



-- 
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