开源线程库lib [英] Open source threadpool lib

查看:139
本文介绍了开源线程库lib的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在寻找可用于安排作业的开源线程池库,一旦完成单个作业,我希望在线程中发出一些通知,以便完成其余任务.你们知道做类似工作的任何开源库吗?我可能在多个差异服务器中使用了这个库.

我的任务的基本概述是我有项目清单.每个项目都需要通过JMS/Webservice提交到其他系统,然后等待正在处理的每个项目的响应并完成其余任务.

预先感谢

解决方案

juc Future 应该符合您指定的规格.如果您有特定的阻止此线程,直到完成以下任务集"行为,则还可以使用 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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆