[concurrency-interest] PooledExecutor question
Fri, 15 Oct 2004 08:10:13 -0700 (PDT)
You could alternatively use the semaphore class. Init
the semaphore to the same size as the thread pool,
check out a permit before submitting a runnable, and
then release the permit in the runnables finally. Then
do a loop after the threads are started, checking to
see if the semaphore permits size reach max, then
break out of the loop knowing that the threads
--- Vitaliy Geraymovych <email@example.com>
> I am still checking but it seems that
> e.awaitTerminationAfterShutdown() does the trick.
> On Thu, 14 Oct 2004 12:03:04 -0700, Joe Bowbeer
> <firstname.lastname@example.org> wrote:
> > Have you tried
> > To shutdown a thread pool and await termination,
> you would:
> > threadPool.shutdown();
> > threadPool.awaitTermination(timeout, timeUnit);
> > Same problem different class? Or does this work
> for you?
> > ----- Original Message -----
> > From: "Vitaliy Geraymovych"
> > To: <email@example.com>
> > Sent: Thursday, October 14, 2004 7:53 AM
> > Subject: [concurrency-interest] PooledExecutor
> > Hi All,
> > I am having problems using PooledExecutor. After
> submitting Runnables
> > into the pool I need to wait until all of them are
> completed. Call to
> > shutdownAfterProcessingCurrentlyQueuedTasks after
> submitting all tasks
> > doesn't seem to help.
> > Problem is happening when I am running JUnit .
> JUnit terminates before
> > all tasks are completed and as the result several
> tasks remain
> > unfinished.
> > Is there a way to wait until PooledExecutor
> finishes all tasks
> > submitted into the queue?
> > Thanks,
> > Vitaliy
> > _______________________________________________
> > Concurrency-interest mailing list
> > Concurrencyfirstname.lastname@example.org
> Concurrency-interest mailing list
Do you Yahoo!?
Yahoo! Mail Address AutoComplete - You start. We finish.