Re: Runnable hangs using jersey-apache-client4 1.19
Turned out to be not an HTTP problem after all. Sorry!
On Sun, Dec 4, 2016 at 3:50 PM, Martynas Jusevičius
<[hidden email]> wrote:
> Hey all,
> I have been successfully using jersey-apache-client4 for a while, but
> after I refactored the application to use multiple threads, the client
> requests in Runnable seem to hang.
> I am using Jersey 1.19 and passing Client to threads spawned by a
> thread pool in ServletContextListener. The code in Runnable that reads
> the stream from ClientResponse
> InputStream is = fileResponse.getEntityInputStream();
> seems to hang - the debugger steps to the next line that attempts to
> read, and after that the Runnable never continues.
> I am using ThreadSafeClientConnManager which is supposed to be
> thread-safe. In the log I can see some lines as
> 15:36:00,225 DEBUG ConnPoolByRoute:523 - No free connections
> So I tried to increase the connection limits for my main routes:
> ThreadSafeClientConnManager cm = new ThreadSafeClientConnManager();
> HttpRoute localhost = new HttpRoute(new HttpHost("localhost", 8080));
> HttpRoute remote = new HttpRoute(new HttpHost("remote.com", 1982));
> cm.setMaxForRoute(localhost, 50);
> cm.setMaxForRoute(remote, 50);
> This doesn't seem to have any effect though. Any clues?