qianye1001 opened a new pull request, #1319:
URL: https://github.com/apache/rocketmq-clients/pull/1319

   ### Which Issue(s) This PR Fixes
   
   Fixes #1318
   
   ### Brief Description
   
   This change adds an opt-in `enableVirtualThreads(boolean)` client 
configuration. It is disabled by default.
   
   When enabled on JDK 21 or later, the Java client uses 
virtual-thread-per-task executors for asynchronous RPC work, client callbacks, 
telemetry commands, and push-consumer message processing. The JDK 21 executor 
API is discovered through reflection so the project keeps its existing Java 8 
compilation target and remains runnable on older JDKs. If virtual threads are 
unavailable, the client falls back to the existing platform-thread executors.
   
   Push-consumer execution uses a fair `Semaphore` so 
`setConsumptionThreadCount` remains the maximum number of concurrently running 
consumption tasks. Waiting virtual threads park without occupying carrier 
threads. Scheduled executors remain platform-thread based.
   
   ### How Did You Test This Change?
   
   - JDK 21 targeted tests:
     - `mvn -pl client -am -Dspotbugs.skip=true -Djacoco.skip=true 
-Dtest=ClientConfigurationTest,ExecutorServicesTest -DfailIfNoTests=false 
-Dsurefire.failIfNoSpecifiedTests=false test`
     - 5 tests passed.
   - JDK 11 clean full client test suite:
     - `mvn -pl client -am clean -Dspotbugs.skip=true test`
     - 296 tests run, 0 failures, 0 errors, 1 skipped.
   - Verified `ClientConfiguration.class` and `ExecutorServices.class` both 
have class-file major version 52.
   - Built the shaded client on a remote Alibaba AJDK 21 environment and ran a 
real producer/consumer test:
     - 64 asynchronous sends succeeded;
     - send callbacks and message listeners ran on virtual threads;
     - with `setConsumptionThreadCount(1)`, the maximum observed concurrent 
listeners was exactly 1.
   


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