Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 10 years ago.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(5)
看看 Doug Lea 的书……它们现在已经相当老了(除非他发布了新书,不确定),但是 1.5 中添加的并发包是基于他的线程库的。就我而言,他是 Java 并发编程方面的权威...他的书将为您提供完成此任务所需了解的基础知识。
我只能假设这是一项学术练习...如果不是,我强烈建议您坚持使用并发包,因为它经过了良好的测试和良好的开发...不要重新发明轮子。祝你好运。
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.
我绝对推荐阅读“实践中的并发”。这是处理 Java 线程问题的第一本书。
I definitely recommend reading "concurrency in practice". It's the number one book dealing with threading issues in Java.
您可以查看
ThreadPoolExecutor
来自核心java。但你为什么要重新发明轮子呢?You could have a look at the source code for
ThreadPoolExecutor
from core java. Though why do you want to reinvent the wheel?http://java.sun.com/docs/books/教程/essential/concurrency/pools.html
http://java.sun.com/docs/books/tutorial/essential/concurrency/pools.html
我同意不需要重新发明轮子,我们应该坚持执行器框架。但即使我也很好奇 Executor 框架中线程池是如何实现的。
发现这个有趣的链接,其中讨论了如何使用线程以自定义方式实现线程池:http://www.ibm.com/developerworks/library/j-jtp0730/index.html
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