users@jersey.java.net

[Jersey] Client Configuration Questions

From: Robert DiFalco <robert.difalco_at_gmail.com>
Date: Mon, 24 Feb 2014 11:34:40 -0800

This is not a big deal since I only use the client for testing and this
just appears to be a small performance issue, that said I was curious about
the following.

It appears that every time I make a request of the client (even a shared
client) a new snapshot is taken of the client configuration. This is not a
deep snapshot so on every call things like my JacksonFeature or any other
registered items have to be reloaded and re-evaluated. These are not
state-full so it seems to be an unnecessary expense. Is this done to avoid
possible threading issues? Seems like I have to be careful what I put here.

Just as an example (and maybe I'm using the client API incorrect) but the
following will instantiate all my features and evaluate them 3 times (in
additional to anything else in the client configuration):

    target( uri ).request().post( ... );
    target( uri ).request().get( type );
    target( uri ).request().delete( ... );

Should I be caching the request? These are not all called bare like this
but nested inside my own API so caching will be a little tricky. But if
that is what is required I can do it.

Thanks!