davsclaus commented on code in PR #28184:
URL: https://github.com/apache/camel/pull/28184#discussion_r4326314343


##########
components/camel-cxf/pom.xml:
##########
@@ -32,6 +32,10 @@
     <name>Camel :: CXF :: Parent</name>
     <description>Camel CXF parent</description>
 
+    <properties>
+        <camel.surefire.forkCount>0.5C</camel.surefire.forkCount>

Review Comment:
   This applies to every camel-cxf child, including the modules that reuse 
forks (soap, rest, transport), not only the two spring modules. Also `0.5C` 
grows with the agent's core count: 16 JVMs per module on a 32-core agent with 
`-T1C`. Would a fixed count like `camel-spring-xml`'s `4` be safer for memory?



##########
components/camel-cxf/camel-cxf-common/src/test/java/org/apache/camel/component/cxf/common/CXFTestSupport.java:
##########
@@ -19,72 +19,70 @@
 import org.apache.camel.test.AvailablePortFinder;
 
 /**
- * For test cases that use unique contexts, they can share the ports which 
will make things a bit faster as ports aren't
- * opened and closed all the time.
+ * Provides pre-allocated port numbers as system properties for test cases and 
Spring XML contexts.
  */
 public final class CXFTestSupport {
 
-    static final int PORT1 = AvailablePortFinder.getNextRandomAvailable();
-    static final int PORT2 = AvailablePortFinder.getNextRandomAvailable();
-    static final int PORT3 = AvailablePortFinder.getNextRandomAvailable();
-    static final int PORT4 = AvailablePortFinder.getNextRandomAvailable();
-    static final int PORT5 = AvailablePortFinder.getNextRandomAvailable();
-    static final int PORT6 = AvailablePortFinder.getNextRandomAvailable();
-    static final int PORT7 = AvailablePortFinder.getNextRandomAvailable();
-    static final int SSL_PORT = AvailablePortFinder.getNextRandomAvailable();
+    static final AvailablePortFinder.Port PORT1 = AvailablePortFinder.find();
+    static final AvailablePortFinder.Port PORT2 = AvailablePortFinder.find();
+    static final AvailablePortFinder.Port PORT3 = AvailablePortFinder.find();
+    static final AvailablePortFinder.Port PORT4 = AvailablePortFinder.find();
+    static final AvailablePortFinder.Port PORT5 = AvailablePortFinder.find();
+    static final AvailablePortFinder.Port PORT6 = AvailablePortFinder.find();
+    static final AvailablePortFinder.Port PORT7 = AvailablePortFinder.find();
+    static final AvailablePortFinder.Port SSL_PORT = 
AvailablePortFinder.find();
 
     static {
         //set them as system properties so Spring can use the property 
placeholder
         //things to set them into the URL's in the spring contexts
-        System.setProperty("CXFTestSupport.port1", Integer.toString(PORT1));
-        System.setProperty("CXFTestSupport.port2", Integer.toString(PORT2));
-        System.setProperty("CXFTestSupport.port3", Integer.toString(PORT3));
-        System.setProperty("CXFTestSupport.port4", Integer.toString(PORT4));
-        System.setProperty("CXFTestSupport.port5", Integer.toString(PORT5));
-        System.setProperty("CXFTestSupport.port6", Integer.toString(PORT6));
-        System.setProperty("CXFTestSupport.port7", Integer.toString(PORT7));
-        System.setProperty("CXFTestSupport.sslPort", 
Integer.toString(SSL_PORT));
-        
System.setProperty("org.apache.cxf.transports.http_undertow.DontClosePort", 
"true");
+        System.setProperty("CXFTestSupport.port1", PORT1.toString());
+        System.setProperty("CXFTestSupport.port2", PORT2.toString());
+        System.setProperty("CXFTestSupport.port3", PORT3.toString());
+        System.setProperty("CXFTestSupport.port4", PORT4.toString());
+        System.setProperty("CXFTestSupport.port5", PORT5.toString());
+        System.setProperty("CXFTestSupport.port6", PORT6.toString());
+        System.setProperty("CXFTestSupport.port7", PORT7.toString());
+        System.setProperty("CXFTestSupport.sslPort", SSL_PORT.toString());

Review Comment:
   With `DontClosePort` gone, `CxfCustomerStartStopTest` 
(camel-cxf-spring-soap) restores it as `orig == null ? "true" : "false"`. 
`orig` is now null, so after that test the property is `true` for the rest of 
the JVM. It is harmless with `reuseForks=false`, but 
`System.clearProperty(...)` when `orig == null` would be correct. Dropping the 
toggling there would also work.



##########
components/camel-cxf/camel-cxf-common/src/test/java/org/apache/camel/component/cxf/common/CXFTestSupport.java:
##########
@@ -19,72 +19,70 @@
 import org.apache.camel.test.AvailablePortFinder;
 
 /**
- * For test cases that use unique contexts, they can share the ports which 
will make things a bit faster as ports aren't
- * opened and closed all the time.
+ * Provides pre-allocated port numbers as system properties for test cases and 
Spring XML contexts.
  */
 public final class CXFTestSupport {
 
-    static final int PORT1 = AvailablePortFinder.getNextRandomAvailable();
-    static final int PORT2 = AvailablePortFinder.getNextRandomAvailable();
-    static final int PORT3 = AvailablePortFinder.getNextRandomAvailable();
-    static final int PORT4 = AvailablePortFinder.getNextRandomAvailable();
-    static final int PORT5 = AvailablePortFinder.getNextRandomAvailable();
-    static final int PORT6 = AvailablePortFinder.getNextRandomAvailable();
-    static final int PORT7 = AvailablePortFinder.getNextRandomAvailable();
-    static final int SSL_PORT = AvailablePortFinder.getNextRandomAvailable();
+    static final AvailablePortFinder.Port PORT1 = AvailablePortFinder.find();

Review Comment:
   Note: `find()` only records the port in a map inside this JVM, and the probe 
socket is closed before Undertow binds. Other forks and module JVMs under 
`-T1C` cannot see it. So this makes cross-process collisions less likely, but 
it does not rule them out.



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