jamesnetherton commented on a change in pull request #3555:
URL: https://github.com/apache/camel-quarkus/pull/3555#discussion_r808107427



##########
File path: 
integration-tests-support/test-support/src/main/java/org/apache/camel/quarkus/test/AvailablePortFinder.java
##########
@@ -54,15 +57,23 @@ private AvailablePortFinder() {
      * @return                       the available port
      */
     public static int getNextAvailable() {
+        // Using AvailablePortFinder in native applications can be problematic
+        // E.g The reserved port may be allocated at build time and preserved 
indefinitely at runtime. I.e it never changes on each execution of the native 
application
+        logWarningIfNativeApplication();
+
         while (true) {
             try (ServerSocket ss = new ServerSocket()) {
                 ss.setReuseAddress(true);
                 ss.bind(new InetSocketAddress((InetAddress) null, 0), 1);
 
                 int port = ss.getLocalPort();
                 if (!isQuarkusReservedPort(port)) {
-                    LOGGER.info("getNextAvailable() -> {}", port);
-                    return port;
+                    String callerClassName = getCallerClassName();
+                    String value = RESERVED_PORTS.putIfAbsent(port, 
callerClassName);

Review comment:
       Ok - after re-reading. It's about separate `RESERVED_PORTS` instances.
   
   In which case, yes, I suppose the map contents would be different between 
concurrent JVMs or class loaders.




-- 
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-unsubscr...@camel.apache.org

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


Reply via email to