users@jersey.java.net

[Jersey] Re: Does jersey create a new resource instance for every call?

From: Paul Sandoz <Paul.Sandoz_at_oracle.com>
Date: Wed, 19 Jan 2011 10:58:59 +0100

On Jan 19, 2011, at 4:41 AM, Tony Anecito wrote:

> Hi All,
>
> I noticed that it appears that jersey servlet (1.5) in Tomcat 6.0.20
> creates a
> new instance of the resource object for every call.

Yes, the default for JAX-RS is per-request scope.


> I say this becuase I noticed
> my constructor of my resource object gets called for every get/post/
> put from my
> jersey client. Is that correct? If so it seems to reduce scalability.

How so?


> Is there a pool of resources objects I can configure for?
>

You can use stateless EJBs in the war for that.

Paul.