Overview | Package | Class | Tree | Deprecated | Index | Help
| Spring Framework
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.springframework.ejb.access
Class AbstractRemoteSlsbInvokerInterceptor

    java.lang.Object
      org.springframework.jndi.JndiAccessor
          org.springframework.jndi.JndiLocatorSupport
              org.springframework.jndi.JndiObjectLocator
                  org.springframework.ejb.access.AbstractSlsbInvokerInterceptor
                      org.springframework.ejb.access.AbstractRemoteSlsbInvokerInterceptor

All Implemented Interfaces:
  org.aopalliance.aop.Advice, org.aopalliance.intercept.Interceptor, org.aopalliance.intercept.MethodInterceptor, InitializingBean

Direct Known Subclasses:
  SimpleRemoteSlsbInvokerInterceptor

    public abstract class AbstractRemoteSlsbInvokerInterceptor

extends AbstractSlsbInvokerInterceptor

Base class for interceptors proxying remote Stateless Session Beans. Designed for EJB 2.x, but works for EJB 3 Session Beans as well.

Such an interceptor must be the last interceptor in the advice chain. In this case, there is no target object.

Author:
  Rod Johnson, Juergen Hoeller

Field Summary

Fields inherited from class org.springframework.jndi.JndiLocatorSupport
`CONTAINER_PREFIX`

Fields inherited from class org.springframework.jndi.JndiAccessor
`logger`

Constructor Summary
`AbstractRemoteSlsbInvokerInterceptor()`

Method Summary
`protected abstract java.lang.Object` | `doInvoke(org.aopalliance.intercept.MethodInvocation invocation)` Perform the given invocation on the current EJB home.
`protected java.lang.reflect.Method` | `getCreateMethod(java.lang.Object home)` Check for EJB3-style home object that serves as EJB component directly.
`java.lang.Object` | `invokeInContext(org.aopalliance.intercept.MethodInvocation invocation)` Fetches an EJB home object and delegates to `doInvoke`.
`protected boolean` | `isConnectFailure(java.rmi.RemoteException ex)` Determine whether the given RMI exception indicates a connect failure.
`protected boolean` | `isHomeRefreshable()` Return whether the cached EJB home object is potentially subject to on-demand refreshing.
`protected java.lang.Object` | `lookup()` This overridden lookup implementation performs a narrow operation after the JNDI lookup, provided that a home interface is specified.
`protected java.lang.Object` | `newSessionBeanInstance()` Return a new instance of the stateless session bean.
`protected java.lang.Object` | `refreshAndRetry(org.aopalliance.intercept.MethodInvocation invocation)` Refresh the EJB home object and retry the given invocation.
`protected void` | `removeSessionBeanInstance(javax.ejb.EJBObject ejb)` Remove the given EJB instance.
`void` | `setHomeInterface(java.lang.Class homeInterface)` Set a home interface that this invoker will narrow to before performing the parameterless SLSB `create()` call that returns the actual SLSB proxy.
`void` | `setRefreshHomeOnConnectFailure(boolean refreshHomeOnConnectFailure)` Set whether to refresh the EJB home on connect failure.

Methods inherited from class org.springframework.ejb.access.AbstractSlsbInvokerInterceptor
`afterPropertiesSet, create, getHome, invoke, refreshHome, setCacheHome, setExposeAccessContext, setLookupHomeOnStartup`

Methods inherited from class org.springframework.jndi.JndiObjectLocator
`getExpectedType, getJndiName, setExpectedType, setJndiName`

Methods inherited from class org.springframework.jndi.JndiLocatorSupport
`convertJndiName, isResourceRef, lookup, lookup, setResourceRef`

Methods inherited from class org.springframework.jndi.JndiAccessor
`getJndiEnvironment, getJndiTemplate, setJndiEnvironment, setJndiTemplate`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### AbstractRemoteSlsbInvokerInterceptor

    public AbstractRemoteSlsbInvokerInterceptor()

Method Detail

### setHomeInterface

    public void setHomeInterface(java.lang.Class homeInterface)

  Set a home interface that this invoker will narrow to before performing the parameterless SLSB `create()` call that returns the actual SLSB proxy.

  Default is none, which will work on all J2EE servers that are not based on CORBA. A plain `javax.ejb.EJBHome` interface is known to be sufficient to make a WebSphere 5.0 Remote SLSB work. On other servers, the specific home interface for the target SLSB might be necessary.

### setRefreshHomeOnConnectFailure

    public void setRefreshHomeOnConnectFailure(boolean refreshHomeOnConnectFailure)

  Set whether to refresh the EJB home on connect failure. Default is "false".

  Can be turned on to allow for hot restart of the EJB server. If a cached EJB home throws an RMI exception that indicates a remote connect failure, a fresh home will be fetched and the invocation will be retried.

  See Also:
    `ConnectException`, `ConnectIOException`, `NoSuchObjectException`

### isHomeRefreshable

    protected boolean isHomeRefreshable()

  Description copied from class: `AbstractSlsbInvokerInterceptor`
  Return whether the cached EJB home object is potentially subject to on-demand refreshing. Default is "false".

  Overrides:
    `isHomeRefreshable` in class `AbstractSlsbInvokerInterceptor`

### lookup

    protected java.lang.Object lookup()
                               throws javax.naming.NamingException

  This overridden lookup implementation performs a narrow operation after the JNDI lookup, provided that a home interface is specified.

  Overrides:
    `lookup` in class `JndiObjectLocator`
  Returns:
    the located target object
  Throws:
    `javax.naming.NamingException` - if the JNDI lookup failed or if the located JNDI object is not assigable to the expected type
  See Also:
    `setHomeInterface(java.lang.Class)`, `PortableRemoteObject.narrow(java.lang.Object, java.lang.Class)`

### getCreateMethod

    protected java.lang.reflect.Method getCreateMethod(java.lang.Object home)
                                                throws EjbAccessException

  Check for EJB3-style home object that serves as EJB component directly.

  Overrides:
    `getCreateMethod` in class `AbstractSlsbInvokerInterceptor`
  Parameters:
    `home` - the EJB home object
  Returns:
    the create method
  Throws:
    `EjbAccessException` - if the method couldn't be retrieved

### invokeInContext

    public java.lang.Object invokeInContext(org.aopalliance.intercept.MethodInvocation invocation)
                                     throws java.lang.Throwable

  Fetches an EJB home object and delegates to `doInvoke`.

  If configured to refresh on connect failure, it will call `refreshAndRetry(org.aopalliance.intercept.MethodInvocation)` on corresponding RMI exceptions.

  Specified by:
    `invokeInContext` in class `AbstractSlsbInvokerInterceptor`
  Parameters:
    `invocation` - the AOP method invocation
  Returns:
    the invocation result, if any
  Throws:
    `java.lang.Throwable` - in case of invocation failure
  See Also:
    `AbstractSlsbInvokerInterceptor.getHome()`, `doInvoke(org.aopalliance.intercept.MethodInvocation)`, `refreshAndRetry(org.aopalliance.intercept.MethodInvocation)`

### isConnectFailure

    protected boolean isConnectFailure(java.rmi.RemoteException ex)

  Determine whether the given RMI exception indicates a connect failure.

  The default implementation delegates to RmiClientInterceptorUtils.

  Parameters:
    `ex` - the RMI exception to check
  Returns:
    whether the exception should be treated as connect failure
  See Also:
    `RmiClientInterceptorUtils.isConnectFailure(java.rmi.RemoteException)`

### refreshAndRetry

    protected java.lang.Object refreshAndRetry(org.aopalliance.intercept.MethodInvocation invocation)
                                        throws java.lang.Throwable

  Refresh the EJB home object and retry the given invocation. Called by invoke on connect failure.

  Parameters:
    `invocation` - the AOP method invocation
  Returns:
    the invocation result, if any
  Throws:
    `java.lang.Throwable` - in case of invocation failure
  See Also:
    `AbstractSlsbInvokerInterceptor.invoke(org.aopalliance.intercept.MethodInvocation)`

### doInvoke

    protected abstract java.lang.Object doInvoke(org.aopalliance.intercept.MethodInvocation invocation)
                                          throws java.lang.Throwable

  Perform the given invocation on the current EJB home. 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
  See Also:
    `AbstractSlsbInvokerInterceptor.getHome()`, `newSessionBeanInstance()`

### newSessionBeanInstance

    protected java.lang.Object newSessionBeanInstance()
                                               throws javax.naming.NamingException,
                                                      java.lang.reflect.InvocationTargetException

  Return a new instance of the stateless session bean. To be invoked by concrete remote SLSB invoker subclasses.

  Can be overridden to change the algorithm.

  Throws:
    `javax.naming.NamingException` - if thrown by JNDI
    `java.lang.reflect.InvocationTargetException` - if thrown by the create method
  See Also:
    `AbstractSlsbInvokerInterceptor.create()`

### removeSessionBeanInstance

    protected void removeSessionBeanInstance(javax.ejb.EJBObject ejb)

  Remove the given EJB instance. To be invoked by concrete remote SLSB invoker subclasses.

  Parameters:
    `ejb` - the EJB instance to remove
  See Also:
    `EJBObject.remove()`

Overview | Package | Class | Tree | Deprecated | Index | Help
| Spring Framework
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD