tjwatson commented on PR #433:
URL: https://github.com/apache/felix-dev/pull/433#issuecomment-3357667904

   > Anything specific? I'm looking at using a MRJ for activemq-client to use 
that for the Virtual Thread classes that need JDK 21+.
   
   Even for that I would use a separate project that holds the Java 21+ code 
that uses Virftual Threads and then pull the classes into the project that 
still targets the old Java release.  Then have code that knows what class to 
load based on Java versions.  That is what we do for the Virtual threads.  We 
then created an `org.osgi.service.condition.Condition` ID for the Java version 
so that we can enable the correct service component based on the Java version.
   
   For example, this component only gets enabled for Java versions < 21:
   
https://github.com/OpenLiberty/open-liberty/blob/f8638a00c65c9dec748d21253571b2d0acd9fcab/dev/com.ibm.ws.threading/src/com/ibm/ws/threading/internal/VirtualThreadDisallowed.java#L34
   
   And this one gets enabled for Java versions >= 21
   
   
https://github.com/OpenLiberty/open-liberty/blob/f8638a00c65c9dec748d21253571b2d0acd9fcab/dev/io.openliberty.threading.virtual.internal/src/io/openliberty/threading/virtual/internal/VirtualThreadOperations.java#L40
   
   The rest of the system gets injected with the right component implementation 
without having to worry about what Java version is running.


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