users@jersey.java.net

Re: [Jersey] Client.create() is expensive,

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Mon, 01 Dec 2008 10:55:53 +0100

> WebResource should implement equals() and hashCode()

Done.


> mmutableMultivaluedMap to UnmodifiableMultivaluedMap


Done.

On Dec 1, 2008, at 10:16 AM, Gili wrote:

>
> I profiled my code and was surprised to discover how expensive
> Client.create() calls are. I would suggest you document in the
> Javadoc that
> creating a Client is expensive and should only be done once per
> configuration type across the entire lifetime of the application.
>

Done.

> To put things in perspective, my application was spending 10x more
> time in
> Client.create() than retrieving data from the server. It was that
> bad :) I
> was creating one instance per resource instance.

Having a clone operation might be useful. Also if using the Client on
the server side then it should be possible to share some state.

Paul.