DefaultMessageListenerContainer and its base class AbstractJmsListeningContainer use synchronization for lifecycle and shared connection management. This can be replaced with ReentrantLock in order to improve virtual thread compatibility during the startup and shutdown phase. The message receive step is executing outside of a lock, so general virtual thread compatibility is given already.

Since DefaultMessageListenerContainer internally creates a SimpleAsyncTaskExecutor by default, an explicit virtual thread setup option it is also worth considering, e.g. a setVirtualThreads flag to simply pass through to the internal SimpleAsyncTaskExecutor instance.

Comment From: ceremo

Hi @jhoeller,

I don't understand why https://github.com/spring-projects/spring-framework/blob/v6.2.0-RC3/spring-jms/src/main/java/org/springframework/jms/config/DefaultJmsListenerContainerFactory.java has been kept out of the scope of this issue.

Thanks for your time.