-
1. Re: How to use container managed threads
sfcoy Aug 21, 2012 8:39 PM (in response to devinderpal)1 of 1 people found this helpful -
2. Re: How to use container managed threads
devinderpal Aug 22, 2012 8:17 AM (in response to sfcoy)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.
-
3. Re: How to use container managed threads
sfcoy Aug 22, 2012 8:36 AM (in response to devinderpal)1 of 1 people found this helpfulThe 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.
-
4. Re: How to use container managed threads
jbertram Aug 22, 2012 9:48 AM (in response to devinderpal)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.
-
5. Re: How to use container managed threads
devinderpal Aug 24, 2012 5:56 AM (in response to jbertram)ok thanks guys. That really helps.