Java Thread Pool [closed]

帅比萌擦擦* 提交于 2020-01-11 06:27:09

问题


I want to learn to write a thread pool in Java

Can anyone point me to useful resources ?


回答1:


You could have a look at the source code for ThreadPoolExecutor from core java. Though why do you want to reinvent the wheel?




回答2:


take a look at Doug Lea's books... they are fairly old now (unless he released a new one, not sure), but the concurrent package added in 1.5 is based on his threading libraries. as far as i am concerned, he is the authority on concurrent programming in java... his books will give you the basics of what you need to understand to accomplish this task.

i can only assume this is an academic exercise... if not, i would strongly recommend you stick to the concurrent package as it is well-tested and well-developed... don't re-invent the wheel. good luck.




回答3:


I definitely recommend reading "concurrency in practice". It's the number one book dealing with threading issues in Java.




回答4:


http://java.sun.com/docs/books/tutorial/essential/concurrency/pools.html




回答5:


I agree that re-inventing wheel is not required and we should stick to Executor framework. But even i was curious to know how thread pool is implemented in Executor framework.

found this interesting link which talks how thread pool can be implemented in custom way using threads : http://www.ibm.com/developerworks/library/j-jtp0730/index.html



来源:https://stackoverflow.com/questions/2386761/java-thread-pool

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!