Rules of a ThreadPoolExecutor pool size
13 comments
Comment from: Suryakant B [Visitor]
Thanks for a simple but informative and to the point explanation
Comment from: vwchong [Visitor]
You can have the other way if number of threads is less than the core pool size, isn’t it? I.e your point 1.
Comment from: Ponnusamy [Visitor]
Exactly. I also surprised that why sun implementation was like that. If we use unbounded queue, then maxcorepoolsize will never be used.
Comment from: Gaurav Seth [Visitor]
Very nice explanation. I have been searching this and finally got it here.
Comment from: vivek singh [Visitor]
This is what I was looking for. Thanks a ton
Comment from: amitabh roy [Visitor]
Thanks a lot. a very good explanation!
Comment from: Samy [Visitor]
Thanks a lot… you saved my day.. was facing lot issues since threadpool was configured as per “User anticipated way”
Comment from: Latif [Visitor]
Great Explanation. Thank you very much .
Comment from: ck [Visitor]
Great Explanation. Thank you very much. Save me a Day!
Comment from: Mina [Visitor]
Thanks a lot, but I have a question: core size= 1, max=2, queue capacity =2, if task 1 is running, task 2 and task 3 are in queue , then task 4 arrive , according your explanation a new thread created (growing threadpool ), which task come to new thread to run, task 2 or task 4?
Comment from: Ajay [Visitor]
thanks for making it easy to understand
Comment from: Baka [Visitor]
@Mina, since it is a queue, task2 will run
Comment from: Fabian [Visitor]
Thank you very much for this, to implement it like you suggested I did this
“There is an interesting method allowCoreThreadTimeOut(boolean) which allows core threads to be killed after given idle time. Setting this to true and setting core threads = max threads allows the thread pool to scale between 0 and max threads”
as written by Jaroslaw Pawlak in: Stackoverflow: Core Pool Size vs Maximum Pool Size in ThreadPoolExecutor
Form is loading...