问题描述
我一直在寻找可用于安排作业的开源线程池库,一旦完成单个作业,我希望在线程中发出一些通知,以便完成其余任务.你们知道做类似工作的任何开源库吗?我可能在多个差异服务器中使用了这个库.
我的任务的基本概述是我有项目清单.每个项目都需要通过JMS/Webservice提交到其他系统,然后等待正在处理的每个项目的响应并完成其余任务.
预先感谢
juc ThreadPoolExecutor ?正确包装并明智使用 Future 应该符合您指定的规格.如果您有特定的阻止此线程,直到完成以下任务集"行为,则还可以使用 CompletionService .
正如另一位回答者所指出的,您也可以一路使用 Quartz Scheduler ,如果您确实需要全面的任务计划服务.听起来这对您的问题来说是过大了,但是您没有提供具体细节.如果这是您要走的路,在SO上有在Quartz Scheduler上有很多好的Q + A . /p>
I was looking for open source thread pool lib which I can use to schedule the jobs and once that individual job is done I want some notification in the thread so that I can finish the rest of the task. Do you guys know any open source lib that is doing similar kind of work. I might be using this lib in multiple diff server.
Basic overview of my task is I have list of items. Each items needs to be submitted to other system throgh JMS/Webservice and then wait for response for each items being processed and do the rest of the task.
Thanks in advance
How about j.u.c.ThreadPoolExecutor? Properly wrapped and coupled with judicious use of Future it should meet your stated specs. If you have specific "block this thread until the following task set completes" behavior, you may also make use of a CompletionService.
As another answerer pointed out, you could also jump all the way to using Quartz Scheduler, if you really need a fully-fleshed-out task scheduling service. It sounds like that's overkill for your problem, but you didn't give specifics. If this is the path you take, there's a lot of good Q+A on Quartz Scheduler here at SO.
这篇关于开源线程库lib的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!