-
1. Re: JSR 239 Concurrency API - Kill threads with redeployment
emmartins Apr 29, 2014 7:03 AM (in response to suikast42)You need to terminate the resources your app creates before undeploy, WildFly does not do that.
In your specific case you would need to interrupt the thread and, since you run the thread in a executor (why?), you would also have to cancel the Future object returned on submit, if the execution was not done yet.
-
2. Re: JSR 239 Concurrency API - Kill threads with redeployment
suikast42 Apr 29, 2014 8:22 AM (in response to emmartins)You need to terminate the resources your app creates before undeploy, WildFly does not do that
After reading this article (page 18 ) from oracle I thought that the created thred's lifeclye is bounded to my deployed app. And every created thread over the threadfactory shoould be terminate if the application context is destroyed.
In your specific case you would need to interrupt the thread and, since you run the thread in a executor (why?), you would also have to cancel the Future object returned on submit, if the execution was not done yet.
I'm a little bit confused about the API. There is a ManagedThreadFacotry. So if I create a thread over this factory I can manually start my thread and over ManagedExcecutors I can obtain a future object right?
-
3. Re: JSR 239 Concurrency API - Kill threads with redeployment
emmartins Apr 29, 2014 11:43 AM (in response to suikast42)Obviously I dunno about Oracle's implementation, but in WildFly it's the app that has to terminate resources it creates.
Wrt your code, the ManagedThreadFactory it's useful to create custom executors, or create and managed directly your own threads, which you just start, and if not end themselves, kill it through interrupt. The ManagedExecutorService is a thread pool thus you submit runnable tasks instead of threads which, in case of not ending themselves, should be terminated through the Future object.
-
4. Re: JSR 236 Concurrency API - Kill threads with redeployment
suikast42 Apr 29, 2014 5:13 PM (in response to emmartins)The jsr 236 says on page 26
ManagedExecutorService instances may be terminated or suspended by the application server when applications or components are stopped or the application server itself is shutting down
The may be in this sentence is the evil word, isn't it? :-D
-
5. Re: JSR 236 Concurrency API - Kill threads with redeployment
emmartins Apr 30, 2014 10:14 AM (in response to suikast42)1 of 1 people found this helpfulThat sentence accepts multiple scenarios, and with respect to WildFly, instances are sharable among applications, so we opted for "the application server itself is shutting down".
-
6. Re: JSR 236 Concurrency API - Kill threads with redeployment
suikast42 May 2, 2014 9:43 AM (in response to emmartins)Thank you well for that clarifiaction Eduardo.