简体   繁体   English

通过Netty发出一个http请求

[英]Making one http request with Netty

In all of the http examples for Netty the client is making just one request and then closes all resources. 在Netty的所有http示例中,客户端仅发出一个请求,然后关闭所有资源。

In order to make the request two new thread pulls are created: 为了发出请求,创建了两个新的线程提取:

ClientBootstrap bootstrap = new ClientBootstrap(
              new NioClientSocketChannelFactory(
                        Executors.newCachedThreadPool(),
                        Executors.newCachedThreadPool()));

And I'm wondering if this is necessary for just one request, especially when the requests in the examples are synchronized, isn't there a simpler way to make that just one request? 我想知道是否只有一个请求是必要的,尤其是在示例中的请求同步时,难道没有更简单的方法可以使仅一个请求吗?

Thanks. 谢谢。

Why do you need Netty for just one request? 为什么只需要一个请求就需要Netty? There are simpler ways to do that. 有更简单的方法可以做到这一点。 Using of Netty implies working with heavy load. 使用Netty意味着要承受繁重的工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM