Using CommonJ WorkManagerTaskExecutor Spring 3 for multithreading

Greetings to everyone I am new to the forum, and I had a question about working with Spring commonj WorkManagerTaskExecutor. I was on a bunch of forums that were looking for the best information on this, but I did not see anything detailed in this matter. So, here is my situation.

My application uses several threads that ThreadPoolTaskExecutor handled, which, it seemed to me, said that it would not be the right choice, since we are using the websphere 7.0 application server. I had everything that was correct, and with some minor tweaking, I managed to replace ThreadPoolTaskExecutor WorkManagerTaskExecutor. When I launch the application, the threads are started using the default manager on the websphere server. The problem that seems to be happening is that although I use workManagerTaskExecutor.waitForAll (collection, timeout); He never waits for threads to complete. I know that it works that threads execute their respective methods, because if you choose a long loop for a loop, then all the data will be where there is no data that is not there. I was interested in the following two things.

  • Is WorkManagerTaskExecutor a way? Or is using ThreadPoolTaskExecutor enough to handle multiple threads in a corporate web application?

  • If WorkManagerTaskExecutor is the way to go? Any ideas as to why the waitForAll method exits, as if the methods were executed? When is it clear that this is not so? After the page loads, I can see in the log that the methods are still running and are eventually ending.

Any help would be greatly appreciated. If I left something, I would love to try to provide additional information about the problem, as I really appreciate any help that can be provided.

Thanks Advance,

Bill

+3
source share
2 answers

, java.util.concurrent.Executor, JavaSE, Spring IoC, WorkManagerTaskExecutor Websphere.

, - Java , JVM, ThreadPoolTaskExecutor - .

API CommonJ WorkManager (JSR 237), , waitForAll, IBM Websphere Oracle WebLogic.

+3

:

List<Callable<?>> callables = new ArrayList<Callable<?>>();
    List<Future<?>> futures = new ArrayList<Future<?>>();
    for (int i = 0; i<callers.length;i++){
        callables.add(new MainTaskExecutor(this,entity,callers[i]));

    }
    for (Callable c:callables){
        futures.add(workTaskExecutor.submit(c));
    }
    for (Future<?> f:futures){
        do{}while(!f.isDone());
    }
0

All Articles