On Wed, May 13, 2009 at 2:20 AM, Manik Surtani <manik(a)jboss.org> wrote:
So, the InboundInvocationHandler (IIH) is a GLOBAL component, since it is
accessed by the Transport to dispatch RPC from remote hosts to local caches.
Now the IIH *needs* references to NAMED_CACHE components (such as the
InterceptorChain, Configuration, etc) to be able to dispatch remote RPC to
local caches. And since these cannot be injected, they need to be looked up
directly in the named cache's registry.
Just as an aside, in JBoss Seam (and in WebBeans), the dependency
container does allow for injection of narrower scoped instances into
wider scoped instances. For example, a session bean is often injected
with a request bean. When a JSF action is being processed it all just
works.
This is all done using proxies. For example, the references in session
scope referring to instances in request scope are instantiated using a
proxy that asks the container what is the current request scope
instance of this bean (through a thread local), gets its reference,
then calls it.
I'm not sure this is the most efficient way to go, but it's fairly elegant.