users@jersey.java.net

optimizing calls to resources in same VM

From: Louis Polycarpou <Louis.Polycarpou_at_Sun.COM>
Date: Fri, 10 Jul 2009 15:32:26 +0100

I am investigating the use of a layered service design in Jersey:

* browser calls servlet framework which 'triggers' ControllerResource
* ControllerResource invokes one or more other Resources (on same &
differerent VM potentially)
* ControllerResource responds to browser

At the moment, the ControllerResource & other Resources are in the
same VM. If I use Jersey's client API to invoke the other resources,
will it optimise this call or will it go over the TCP/IP stack (rather
like the Local interface in EJBs)? I'm hoping that there's a way to do
this for performance reasons now and so that I can split these out
into different tiers later without having to refactor the way I'm
calling the 'downstream' resources.

I don't like the idea of just instantiating the POJO resources and
using them as standard methods for a number of reasons but out of
interest is there a way to inject urlInfo and other @Context if we are
already in a Resource when we instantiate them?

Thanks,
Louis