-
1. Re: Multi-threading -- using the Java Callable interface with Seam
pmuir Jul 29, 2008 10:42 PM (in response to jfalek)Use Seam's built in async support
-
2. Re: Multi-threading -- using the Java Callable interface with Seam
jfalek Jul 30, 2008 1:21 PM (in response to jfalek)I've been reading up on the @Asynchronous and Quartz but I haven't come across any examples where I could start two (or more) threads and wait for them to finish and then receive their results (like I can using the Callable/Future/ExecutorService framework.
Do you know of an example or could you supply one --- or just give me some pointers in that direction?
Thank you,
James -
3. Re: Multi-threading -- using the Java Callable interface with Seam
hurzeler Nov 11, 2008 7:27 AM (in response to jfalek)Have you found a solution to your multi threading issue using @Asynchronous?
-
4. Re: Multi-threading -- using the Java Callable interface with Seam
amiliosanchez Feb 22, 2010 10:37 PM (in response to jfalek)This problem still exists, you should be able to somehow maintain the various contexts across threads in someway but seeing how they are threadlocal what is the best approach if any?
-
5. Re: Multi-threading -- using the Java Callable interface with Seam
trungsi Jan 28, 2013 6:42 PM (in response to jfalek)Hello,
I'd like resurrect this thread. Because I can't find anything about Seam and multi-threading. I have to divide a processing to several chunks in order to process them in parallel. The results are aggregated then returned to the client. So the async method does not help. I thought of using ExecutorService/Callable/Future to get things done but had threading issues with EntityManager. Here's the code :
@Scope(STATELESS)
public class TheService {
public List<Result> process(List<Param> params) {
for (Param p : params) {
executorService.submit(new Callable<List<Result>>() {
public List<Result> call() {
return internalProcess(p);
}
});
}
}
private List<Result> internalProcess(Param p) {
// process using EntityManager used indirectly by other components injected into TheService instance
}
}
Do you know if it's possible to use plain threads mechanism within Seam application? If yes, how to do it correctly? If not, is there other workarounds or alternatives?
I'm also interrested if you have any pointer to the subject.
Thanks for your help.