Java 有界阻塞队列
我正在寻找一个可以接受任何其他队列并使其有界和阻塞的BoundedBlockingQueue
。
我发现 akka.util.BoundedBlockingQueue 可以做到这一点,但源代码中有一些修复程序。所以我不确定使用该代码是否明智。
最后,我想要一个有界的 PriorityQueue 并且可用于并发使用。
我可以使用其他一些类来完成此任务吗?也许在 Java 7 中?
I am looking for a BoundedBlockingQueue
that can take any other Queue
and make it bounded and blocking.
I found akka.util.BoundedBlockingQueue
which can do that, but the source code has some fixmes in it. So I'm not sure it's clever to use the code.
At the end I want to have a PriorityQueue bounded and useable for concurrent use.
Are there some other classes that I can use for this task? Maybe in Java 7?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
akka BoundedBlockingQueue 对我来说似乎还不错(源代码)。我真的会考虑使用它(至少在为该类编写了一组良好的单元测试之后,因为 akka 中缺少该类的测试)
FIXME 处于非常奇怪的情况,例如在后备队列上调用removeAll,并且在之后它不为空这在后备队列类的实现中是一个非常严重的错误。
我不明白你的意思“代码不允许我使构造函数通用”。
The akka BoundedBlockingQueue seems to be pretty ok for me (Source code). I would really consider using it (at least after writing a good set of unit tests for the class because tests for this class are missing in akka)
The FIXMEs are in pretty strange situations like calling removeAll on the backing queue and it is not empty after that, which is simply a very bad error in the implementation of the backing queue class.
I have not understood what you mean with "the code doesn't let me make the constructor generic".