[undertow-dev] ClientConnection shared by multiple threads

Steve Hu stevehu at gmail.com
Wed Dec 13 19:25:19 EST 2017


Hi,

I saw the following comments in ClientConnection.java

A client connection. This can be used to send requests, or to upgrade the
connection.

In general these objects are not thread safe, they should only be used by
the IO thread that is responsible for the connection. As a result this
client does not provide a mechanism to perform blocking IO, it is designed
for async operation only.

The above comments made me to rethink what I have done with the
UndertowClient. I basically created a wrapper on top of UndertowClient so
that I can have one service calling another service with an HTTP 2.0
connection shared by multiple requests. As I understand the HTTP 2.0
connection supports multiplex so that you can have multiple requests sent
in the same channel in parallel.

Here is one of my examples and I have done some preliminary performance
test without any issue. I am wondering if I should cache the connect as
instance variable instead of static variable of HttpHandler.

https://github.com/networknt/light-example-4j/blob/master/rest/ms_chain/api_a/httpschain/src/main/java/com/networknt/apia/handler/DataGetHandler.java

Also, I realized that if downstream server is not in HTTP 2.0, then I need
to have a connection pool built in order to get better performance. Does
anybody have some example of HTTP connection pool implementation?

Thanks,

Steve
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/undertow-dev/attachments/20171213/6b39c8ea/attachment.html 


More information about the undertow-dev mailing list