ThreadPool 之于 Executor 就像 Polling 之于?
Java 的 Executor(据我理解)是 ThreadPool 概念的抽象 - 可以接受并执行(执行)任务的东西。
我正在寻找轮询概念的类似例外。 我需要不断地从特定队列(未实现 BlockingQueue
)中轮询(出队)项目,执行它们并睡眠,然后重复所有这些直到关闭。
是否有现成的抽象或者我应该自己写一些东西?
(欢迎提出更好的标题)
Java's Executor is (as far as I understand it) an abstraction over the ThreadPool concept - something that can accept and carry out (execute) tasks.
I'm looking for a similar exception for the Polling concept. I need to continuously poll (dequeue) items out of a specific Queue (which does not implement BlockingQueue
), execute them and sleep, and repeat all this until shutdown.
Is there a ready-made abstraction or should I write something on my own?
(Suggestions of a better title are welcome)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
投票很简单:
也许您需要重新表述您的问题,因为我不太确定您到底想做什么?
Polling is easy:
Perhaps you need to rephrase your question as I'm not quite sure exactly what it is you are trying to do?