On Monday 12 February 2001 14:15, Scott wrote:

> > On Mon, Feb 12, 2001 at 01:29:15PM -0500, Gianni Johansson wrote:
> > Also, it looks like ThreadPool.runningThreads() should just be:
> >
> >     private int runningThreads() {
> >     return poolGroup.activeCount();
> >     }
>
> No, because pooled threads are technically active, but arent hosting any
> actual job.
The problem is that you preallocate the Ethreads.  They don't have 
java.lang.Threads associated with them until they run their first job.
i.e. until EThread.begin() is called.  This is what is messing up your 
counting.  

I don't get what you mean by "technically active".  What matters, besides the
number of real java.lang.Thread objects???

Also, using activeCount at all seems suspect. because it is approximate:
http://www.javasoft.com/products/jdk/1.2/docs/api/java/lang/ThreadGroup.html#activeCount()

Why not just use a counter that's incremented when jobs are dequeued and
run in ThreadPool.run() and decremented in ThreadPool.reclaim() ?


On Monday 12 February 2001 14:14, Scott wrote:

> ...  Here's the new patch, which
> had to be a bit more extensive, since it affected the interface as well.
>
> Scott

I applied the patch and retested.  This is still not right.

Uncomment the printlns in ThreadPool.run and ThreadPool.blockingRun
and test.

You will see negative values for runningThreads() in the output.

Also it looks like EThread.run() never exits.  How do you shutdown cleanly?

-- gj

-- 
Web page inside Freenet:
freenet:MSK at SSK@enI8YFo3gj8UVh-Au0HpKMftf6QQAgE/homepage//

_______________________________________________
Devl mailing list
Devl at freenetproject.org
http://www.uprizer.com/mailman/listinfo/devl

Reply via email to