Thanks Stephen. This helps for now.
But I still want to know how to launch new Runnable tasks that can get executed in managed environment by using some Jboss thread pools.
Any help will be appreciated.
1 of 1 people found this helpful
The only other way that I know of is to use a javax.resource.spi.work.WorkManager. But I think you need to write a resource adapter to make use of that (I may be wrong).
Generally speaking, @Asynchronous exists exactly so that you don't have to worry about thread pools at a code level. It *is* the implementation of the "container managed thread service" that you're looking for.
The EJB spec has pretty much always stated
The enterprise bean must not attempt to manage threads.
Stephen is right. Java EE provides mechanisms for running code in other threads (e.g. javax.ejb.Asynchronous, JMS, javax.resource.spi.work.WorkManager (but this is only for JCA resource adapters)). Using some other mechanism would be non-portable and not recommended. Furthermore, while the threads subsystem exists today it is deprecated so it will disappear in the future.
ok thanks guys. That really helps.