lobtx commented on code in PR #30303:
URL: https://github.com/apache/camel/pull/30303#discussion_r4605648481


##########
core/camel-base/src/main/java/org/apache/camel/impl/converter/CoreTypeConverterRegistry.java:
##########
@@ -64,7 +64,8 @@ public <T> T convertTo(Class<T> type, Exchange exchange, 
Object value) throws Ty
     // special enum converter for optional performance
     protected final TypeConverter enumTypeConverter = new EnumTypeConverter();
 
-    private final ConverterStatistics statistics;
+    // not final: the registry is created when the CamelContext is built, 
which can be before the option is set
+    private volatile ConverterStatistics statistics;

Review Comment:
   Thanks, you are right: I missed the 4.7 note on the immutable statistics. 
Reworked in 2943f9199 as you suggested: the registry, `SimpleCamelContext` and 
the `CamelContext` Javadoc are back as on main, and Camel Main now applies the 
option before `build()`, like `configureVirtualThreadsEarly`. The test reads 
the counter before the conversion, and 
`TypeConverterRegistryStatisticsEnabledAfterBuildTest` is gone.
   
   While testing it with a standalone app I found that the early lookup missed 
OS environment variables, as they are mapped to keys in lower case: on main 
`CAMEL_MAIN_VIRTUALTHREADSENABLED=true` does not switch the threads to virtual. 
The lookup is now shared by both options and ignores case, as the auto 
configuration does. Happy to move that part to its own ticket if you prefer.



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