Threadpoolexecutor.maximumPoolSize

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Threadpoolexecutor.maximumPoolSize

fattymelt
I had no idea the java.util.concurrency library had been backported, and
I was so fired up to use it. I have some code that uses a
ThreadPoolExecuter, but it seems that although I have set the
maximumPoolSize to 50 the pool never grows beyond my corePoolSize.

Does anyone have a suggestion as to why this would be the case. Is there
something I should be doing differently?

I check getMaximimPoolSize() in a number of places and it is always 50,
but even though I try to assign 50 threads at once, it only ever start 5
(my corePoolSize).

Any insight would be greatly appreciated.

thanks,
seth
_______________________________________________
Concurrency-interest mailing list
[hidden email]
http://altair.cs.oswego.edu/mailman/listinfo/concurrency-interest
Reply | Threaded
Open this post in threaded view
|

Re: Threadpoolexecutor.maximumPoolSize

Dhanji R. Prasanna
The TPE always starts at corePoolSize. use the prestartCoreThread()
methods to get the threads up to max if needed. Though if they are
idle, it will shrink back down I believe.

Also if you are using ScheduledThreadPoolExecutor implementation, note
that maximumPoolSize has no effect.

On 8/31/06, Seth Green <[hidden email]> wrote:

> I had no idea the java.util.concurrency library had been backported, and
> I was so fired up to use it. I have some code that uses a
> ThreadPoolExecuter, but it seems that although I have set the
> maximumPoolSize to 50 the pool never grows beyond my corePoolSize.
>
> Does anyone have a suggestion as to why this would be the case. Is there
> something I should be doing differently?
>
> I check getMaximimPoolSize() in a number of places and it is always 50,
> but even though I try to assign 50 threads at once, it only ever start 5
> (my corePoolSize).
>
> Any insight would be greatly appreciated.
>
> thanks,
> seth
> _______________________________________________
> Concurrency-interest mailing list
> [hidden email]
> http://altair.cs.oswego.edu/mailman/listinfo/concurrency-interest
>
_______________________________________________
Concurrency-interest mailing list
[hidden email]
http://altair.cs.oswego.edu/mailman/listinfo/concurrency-interest
Reply | Threaded
Open this post in threaded view
|

Re: Threadpoolexecutor.maximumPoolSize

fattymelt
In reply to this post by fattymelt
Sorry. I think I get it now.  I wasn't fully understanding the details
of corePoolSize and maximimPoolSize.

Now I see that corePoolSize, is the number of threads that will get
started before handing requests to my queue.  Assumeing my queue is
large enough to keep them, the number of threads won't go above
corePoolSize.  If my queue gets full, then new threads will get created
until I reach maxPoolSize(). right?

So if I am looking for speed (when I want assign a task, I want it to
run as soon as possible) I should make my queue small and my core and
max large right?

I know I could use a cached executer but I do need to keep some bounds
on my pool.

Seth Green wrote:

> I had no idea the java.util.concurrency library had been backported, and
> I was so fired up to use it. I have some code that uses a
> ThreadPoolExecuter, but it seems that although I have set the
> maximumPoolSize to 50 the pool never grows beyond my corePoolSize.
>
> Does anyone have a suggestion as to why this would be the case. Is there
> something I should be doing differently?
>
> I check getMaximimPoolSize() in a number of places and it is always 50,
> but even though I try to assign 50 threads at once, it only ever start 5
> (my corePoolSize).
>
> Any insight would be greatly appreciated.
>
> thanks,
> seth
> _______________________________________________
> Concurrency-interest mailing list
> [hidden email]
> http://altair.cs.oswego.edu/mailman/listinfo/concurrency-interest
>
_______________________________________________
Concurrency-interest mailing list
[hidden email]
http://altair.cs.oswego.edu/mailman/listinfo/concurrency-interest
Reply | Threaded
Open this post in threaded view
|

Re: Threadpoolexecutor.maximumPoolSize

David Holmes-3
In reply to this post by fattymelt
Seth,

TPE only grows beyond coresize if your queue is bounded and becomes full. If
your queue is unbounded then core is the limit.

David Holmes

> -----Original Message-----
> From: [hidden email]
> [mailto:[hidden email]]On Behalf Of Seth
> Green
> Sent: Thursday, 31 August 2006 5:48 AM
> To: [hidden email]
> Subject: [concurrency-interest] Threadpoolexecutor.maximumPoolSize
>
>
> I had no idea the java.util.concurrency library had been backported, and
> I was so fired up to use it. I have some code that uses a
> ThreadPoolExecuter, but it seems that although I have set the
> maximumPoolSize to 50 the pool never grows beyond my corePoolSize.
>
> Does anyone have a suggestion as to why this would be the case. Is there
> something I should be doing differently?
>
> I check getMaximimPoolSize() in a number of places and it is always 50,
> but even though I try to assign 50 threads at once, it only ever start 5
> (my corePoolSize).
>
> Any insight would be greatly appreciated.
>
> thanks,
> seth
> _______________________________________________
> Concurrency-interest mailing list
> [hidden email]
> http://altair.cs.oswego.edu/mailman/listinfo/concurrency-interest

_______________________________________________
Concurrency-interest mailing list
[hidden email]
http://altair.cs.oswego.edu/mailman/listinfo/concurrency-interest