org.springframework.ejb.access
Class LocalSlsbInvokerInterceptor

java.lang.Object
  extended byorg.springframework.jndi.AbstractJndiLocator
      extended byorg.springframework.ejb.access.AbstractSlsbInvokerInterceptor
          extended byorg.springframework.ejb.access.LocalSlsbInvokerInterceptor
All Implemented Interfaces:
org.aopalliance.aop.Advice, InitializingBean, org.aopalliance.intercept.Interceptor, org.aopalliance.intercept.MethodInterceptor
Direct Known Subclasses:
LocalStatelessSessionProxyFactoryBean

public class LocalSlsbInvokerInterceptor
extends AbstractSlsbInvokerInterceptor

Invoker for a local Stateless Session Bean. Caches the home object. A local EJB home can never go stale.

See AbstractJndiLocator for info on how to specify the JNDI location of the target EJB.

In a bean container, this class is normally best used as a singleton. However, if that bean container pre-instantiates singletons (as do the XML ApplicationContext variants) you may have a problem if the bean container is loaded before the EJB container loads the target EJB. That is because the JNDI lookup will be performed in the init method of this class and cached, but the EJB will not have been bound at the target location yet. The solution is to not pre-instantiate this factory object, but allow it to be created on first use. In the XML containers, this is controlled via the "lazy-init" attribute.

Version:
$Id: LocalSlsbInvokerInterceptor.java,v 1.10 2004/03/19 21:35:54 johnsonr Exp $
Author:
Rod Johnson

Field Summary
 
Fields inherited from class org.springframework.jndi.AbstractJndiLocator
CONTAINER_PREFIX, logger
 
Constructor Summary
LocalSlsbInvokerInterceptor()
           
 
Method Summary
 java.lang.Object invoke(org.aopalliance.intercept.MethodInvocation invocation)
          This is the last invoker in the chain: invoke the EJB.
protected  javax.ejb.EJBLocalObject newSessionBeanInstance()
           
 
Methods inherited from class org.springframework.ejb.access.AbstractSlsbInvokerInterceptor
afterLocated, create, getCachedEjbHome, located
 
Methods inherited from class org.springframework.jndi.AbstractJndiLocator
afterPropertiesSet, getJndiEnvironment, getJndiName, getJndiTemplate, isResourceRef, setJndiEnvironment, setJndiName, setJndiTemplate, setResourceRef
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LocalSlsbInvokerInterceptor

public LocalSlsbInvokerInterceptor()
Method Detail

newSessionBeanInstance

protected javax.ejb.EJBLocalObject newSessionBeanInstance()
                                                   throws java.lang.reflect.InvocationTargetException
Throws:
java.lang.reflect.InvocationTargetException

invoke

public java.lang.Object invoke(org.aopalliance.intercept.MethodInvocation invocation)
                        throws java.lang.Throwable
This is the last invoker in the chain: invoke the EJB.

Throws:
java.lang.Throwable


Copyright (C) 2003-2004 The Spring Framework Project.