users@glassfish.java.net

Re: Poor concurrent Jersey Client performance

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Wed, 19 May 2010 14:29:37 +0200

On May 19, 2010, at 2:17 PM, glassfish_at_javadesktop.org wrote:

> My client code looks like the following (below). I took a look at
> the objects I'm using. It wasn't obvious where I could replace the
> httpclient.
>
> ClientConfig cc = new DefaultClientConfig();
> Client c = Client.create(cc);
>

You can do this:

        MultiThreadedHttpConnectionManager m = new
MultiThreadedHttpConnectionManager();
        // Set properties
        HttpClient hc = new HttpClient(m);
        ApacheHttpClient c = new ApacheHttpClient(new
ApacheHttpClientHandler(hc));

        WebResource r = c.resource(_URL);
        ClientResponse response = r.path(_Method).type
            (MediaType.APPLICATION_XML).post(ClientResponse.class,
_content);
        if (response.getStatus()==200)


When you stated:

  "httpclient properties: max-total-connections"

what exactly are you referring to? properties assocaited with
HttpURLConnection or properties associated with the Apache HTTP
client? I assumed when you mentioned "httpclient" you were referring
to the Apache HTTP client. Also see:

   https://jersey.dev.java.net/nonav/documentation/latest/user-guide.html
#d4e590

Note that i am not aware of any way to configure HttpURLConnection
with such properties you mention, thus i cannot make these general
properties independent of the underlying client implementation.

Paul.


> WebResource r = c.resource(_URL);
> ClientResponse response = r.path(_Method).type
> (MediaType.APPLICATION_XML).post(ClientResponse.class, _content);
> if (response.getStatus()==200)
> ...
> [Message sent by forum member 'davesiracusa']
>
> http://forums.java.net/jive/thread.jspa?messageID=470461
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>