Fork / join Java EE applications?
I know that separating threads is a big taboo in Java EE applications However, I have an application that is a perfect candidate for Java's fork / join mechanism However, since threads should not be created in the application, is there any way to use them in my EJB? I know that in WebSphere applications, the asynchronous bean function provides this functionality However, my application is deployed on JBoss EAP 6.1, so this is not an option
Is there a "legal" way to complete fork / join in Java EE applications?
Solution
The best answer now is the concurrency utils API in the Java EE 7 specification You have managedexecutors and managedthreadpools Since these managed thread functions and managed tasks are controlled by the application server, ensure that your fork connection calculation uses these resources, and then you can ensure that threads are included instead of orphaned threads
Finally, you may have to write a "managed" version of forkjoinpool to get the best solution But it should be possible, because as a first step, the thread pool executor will be replaced with a managed version
PS: Java se 8 must solve this problem when Java se 8 is released!