users@jersey.java.net

Re: [Jersey] Thread waits indefinitely using Apache HTTP based Jersey Client[WAS]Re: Problem switching to ApacheHttpClient in Jersey 1.0.2

From: Imran M Yousuf <imran_at_smartitengineering.com>
Date: Thu, 19 Feb 2009 09:53:41 +0600

On Wed, Feb 18, 2009 at 3:27 PM, Paul Sandoz <Paul.Sandoz_at_sun.com> wrote:
>
> On Feb 18, 2009, at 4:29 AM, Imran M Yousuf wrote:
>
>> Hi Paul,
>>
>> On Tue, Feb 17, 2009 at 9:01 PM, Paul Sandoz <Paul.Sandoz_at_sun.com> wrote:
>>>
>>> <snip />
>>>
>>
>> This IMHO is a very important fix and I am glad that now its in the trunk.
>>
>
> It seems that the Apache HTTP client is less robust with tits connection
> caching than HttpURLConnection.
>
> By default an HttpClient is created as follows:
>
> final HttpClient client = new HttpClient(new
> MultiThreadedHttpConnectionManager());
>
> I wonder if there is a better connection manager configuration that times
> out connections to avoid the dreadful thread locking issue, which IMHO is
> serious issue with the HttpClient, and there are cases which it can still
> manifest when developer forgets to close a stream-based entity.
>

Hmm, a valid point, IMHO, this behavior is coherent with that JDBC
Connection and JPA/Hibernate Session. IMHO, we might just add it to
the JavaDoc's or release notes explicitly as if developers migrate
from Jersey default Client to ApacheHttpClient they might face it.

>
>>> This is fixed in the trunk, and I have updated the JavaDoc of
>>> ApacheHttpClient to reflect the changes i have made.
>>>
>>> So now by default things should work as you initially expected.
>>>
>>
>> Great! I will give the 1.0.3-SNAPSHOT a try sometime later this week.
>> Just FYI, I am working on a simple RESTful WS example that uses Jersey
>> in Server and Client side along with Spring through and through for
>> multi-layer binding plus authentication and authorization. To be
>> honest the Jersey mailing list is so helpful that I could not choose
>> any other JAX-RS implementation :). Thanks a lot.
>>
>
> Thanks. I would like to return the compliment, if you had not given such
> details i would not have been able to fix things so quickly.
>

Thanks a lot, glad to know that I was of some help :).

> Paul.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>
>

Best regards,

-- 
Imran M Yousuf
Entrepreneur & Software Engineer
Smart IT Engineering
Dhaka, Bangladesh
Email: imran_at_smartitengineering.com
Blog: http://imyousuf-tech.blogs.smartitengineering.com/
Mobile: +880-1711402557