带有工作池的HTTP请求队列 [英] HTTP request queue with worker pool

查看:215
本文介绍了带有工作池的HTTP请求队列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发Java应用程序,它通过HTTP协议连接到不同的Web服务器(发送请求并等待响应)。我想使用带队列和工作池的模式,所以我想知道Java中是否有任何框架为此提供方法?

I'm developing application in Java which connects to different web-servers via HTTP protocol (sends them request and waits for response). I would like to use pattern with queue and worker pool, so I'd like to know if there any frameworks in Java providing methods for this?

推荐答案

我认为你所要求的是一个线程池。它有一个任务队列和许多处理这些任务的线程。一点点谷歌搜索java线程池让我在那里,可能是相关的。 http://download.oracle .com / javase / 7 / docs / api / java / util / concurrent / Executors.html#newFixedThreadPool(int

I think what you're asking for is a threadpool. It has a queue of tasks and a number of threads working on those tasks. A little bit of googling for "java threadpool" landed me there, might be relevant. http://download.oracle.com/javase/7/docs/api/java/util/concurrent/Executors.html#newFixedThreadPool(int)

如果你是线程可能会很乱设计时不小心,祝你好运:)

Threading can be messy if you aren't careful when designing, good luck :)

这篇关于带有工作池的HTTP请求队列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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