[infinispan-dev] InboundInvocationHandlerImpl optimization

Manik Surtani manik at jboss.org
Wed May 13 12:35:17 EDT 2009


On 13 May 2009, at 17:06, Elias Ross wrote:

> On Wed, May 13, 2009 at 2:20 AM, Manik Surtani <manik at 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.

I did think of using proxies here, but for a single class (this is the  
only place scope narrowing would happen) and for just 3 or 4  
components that need to be injected in, I thought it was way overkill  
as a performance hit.  Cleaner to just manually pull in the few  
components needed.  If I see a need for scope narrowing in future, I  
would reconsider the use of proxies, but for now I don't really see  
the need.

Cheers
--
Manik Surtani
manik at jboss.org
Lead, Infinispan
Lead, JBoss Cache
http://www.infinispan.org
http://www.jbosscache.org







More information about the infinispan-dev mailing list