org.springframework.ejb.access

Class AbstractSlsbInvokerInterceptor

    • Constructor Detail

      • AbstractSlsbInvokerInterceptor

        public AbstractSlsbInvokerInterceptor()
    • Method Detail

      • setLookupHomeOnStartup

        public void setLookupHomeOnStartup(boolean lookupHomeOnStartup)
        Set whether to look up the EJB home object on startup. Default is "true".

        Can be turned off to allow for late start of the EJB server. In this case, the EJB home object will be fetched on first access.

        See Also:
        setCacheHome(boolean)
      • setCacheHome

        public void setCacheHome(boolean cacheHome)
        Set whether to cache the EJB home object once it has been located. Default is "true".

        Can be turned off to allow for hot restart of the EJB server. In this case, the EJB home object will be fetched for each invocation.

        See Also:
        setLookupHomeOnStartup(boolean)
      • setExposeAccessContext

        public void setExposeAccessContext(boolean exposeAccessContext)
        Set whether to expose the JNDI environment context for all access to the target EJB, i.e. for all method invocations on the exposed object reference.

        Default is "false", i.e. to only expose the JNDI context for object lookup. Switch this flag to "true" in order to expose the JNDI environment (including the authorization context) for each EJB invocation, as needed by WebLogic for EJBs with authorization requirements.

      • refreshHome

        protected void refreshHome()
                            throws javax.naming.NamingException
        Refresh the cached home object, if applicable. Also caches the create method on the home object.
        Throws:
        javax.naming.NamingException - if thrown by the JNDI lookup
        See Also:
        JndiObjectLocator.lookup(), getCreateMethod(java.lang.Object)
      • getCreateMethod

        @Nullable
        protected java.lang.reflect.Method getCreateMethod(java.lang.Object home)
                                                              throws EjbAccessException
        Determine the create method of the given EJB home object.
        Parameters:
        home - the EJB home object
        Returns:
        the create method
        Throws:
        EjbAccessException - if the method couldn't be retrieved
      • getHome

        protected java.lang.Object getHome()
                                    throws javax.naming.NamingException
        Return the EJB home object to use. Called for each invocation.

        Default implementation returns the home created on initialization, if any; else, it invokes lookup to get a new proxy for each invocation.

        Can be overridden in subclasses, for example to cache a home object for a given amount of time before recreating it, or to test the home object whether it is still alive.

        Returns:
        the EJB home object to use for an invocation
        Throws:
        javax.naming.NamingException - if proxy creation failed
        See Also:
        JndiObjectLocator.lookup(), getCreateMethod(java.lang.Object)
      • isHomeRefreshable

        protected boolean isHomeRefreshable()
        Return whether the cached EJB home object is potentially subject to on-demand refreshing. Default is "false".
      • invokeInContext

        @Nullable
        protected abstract java.lang.Object invokeInContext(MethodInvocation invocation)
                                                               throws java.lang.Throwable
        Perform the given invocation on the current EJB home, within the thread context being prepared accordingly. Template method to be implemented by subclasses.
        Parameters:
        invocation - the AOP method invocation
        Returns:
        the invocation result, if any
        Throws:
        java.lang.Throwable - in case of invocation failure
      • create

        protected java.lang.Object create()
                                   throws javax.naming.NamingException,
                                          java.lang.reflect.InvocationTargetException
        Invokes the create() method on the cached EJB home object.
        Returns:
        a new EJBObject or EJBLocalObject
        Throws:
        javax.naming.NamingException - if thrown by JNDI
        java.lang.reflect.InvocationTargetException - if thrown by the create method