开发者

how do I set time limits for individual threads in a thread pool?

how do I set time limits for individual threads in a thread pool..? The parent thread need not wait until eve开发者_如何学Gory thread finishes and returns back. Instead it should fetch the next job(runnable/callable) and submit to the thread pool...


More context would be useful.

You might try using ExecutorCompletionService:

http://download.oracle.com/javase/1.5.0/docs/api/java/util/concurrent/ExecutorCompletionService.html


You can add a task to the same pool, or another one which will cancel the first task after a given amount of time. If it has completed this does nothing.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜