How can I ensure that my HttpClient 4.1 does not leak sockets?

后端 未结 3 1884
孤街浪徒
孤街浪徒 2021-02-13 17:31

My server uses data from an internal web service to construct its response, on a per request basis. I\'m using Apache HttpClient 4.1 to make the requests. Each initial request

3条回答
  •  太阳男子
    2021-02-13 18:35

    One needs to pro-actively evict expired / idle connections from the connection pool, as in the blocking I/O model connections cannot react to I/O events unless they are being read from / written to. For details see

    http://hc.apache.org/httpcomponents-client-dev/tutorial/html/connmgmt.html#d4e631

提交回复
热议问题