logo       

Re: How do I wait for the thread from theThreadPool to finish?: msg#00036

java.jsr.166-concurrency

Subject: Re: How do I wait for the thread from theThreadPool to finish?

Correction:

completionService.submit(task, null).get();


-or-

completionService.submit(task, null);

completionService.take();



----- Original Message -----
From: "Joe Bowbeer" <jozart@xxxxxxxxx>
To: <concurrency-interest@xxxxxxxxxxxxxxxxxxxx>
Sent: Friday, February 25, 2005 8:27 PM
Subject: Re: [concurrency-interest] How do I wait for the thread from
theThreadPool to finish?


MH asks:

> Once I create my runnable task that needs to be executed,
> how does the calling thread wait for the [task] to finish

See ExecutorCompletionService

completionService.submit(task, null).take();



----- Original Message -----
From: "Minnie Haridasa" <minnieh@xxxxxxxxxxxxxxxxxx>
To: <concurrency-interest@xxxxxxxxxxxxxxxxxxxx>
Sent: Friday, February 25, 2005 8:07 PM
Subject: [concurrency-interest] How do I wait for the thread from
theThreadPool to finish?


I am trying to use the PooledExecutor to create a thread pool. Once I create
my runnable task that needs to be executed, how does the calling thread wait
for the thread in the pool to finish, especially since I do not have the
handle to the thread that is executing the task.

threadPool.execute(task);

// At this point the calling thread needs to wait for the task to complete.

I am quite new to this Library and would appreciate your help.

Thanks

MH


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise