|
The Spring Framework | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
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
public abstract class AbstractRemoteSlsbInvokerInterceptor
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.
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 Object |
doInvoke(MethodInvocation invocation)
Perform the given invocation on the current EJB home. |
protected Method |
getCreateMethod(Object home)
Check for EJB3-style home object that serves as EJB component directly. |
Object |
invoke(MethodInvocation invocation)
Fetches an EJB home object and delegates to doInvoke. |
protected boolean |
isConnectFailure(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 Object |
lookup()
This overridden lookup implementation performs a narrow operation after the JNDI lookup, provided that a home interface is specified. |
protected EJBObject |
newSessionBeanInstance()
Return a new instance of the stateless session bean. |
protected Object |
refreshAndRetry(MethodInvocation invocation)
Refresh the EJB home object and retry the given invocation. |
protected void |
removeSessionBeanInstance(EJBObject ejb)
Remove the given EJB instance. |
void |
setHomeInterface(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, refreshHome, setCacheHome, 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 |
---|
public AbstractRemoteSlsbInvokerInterceptor()
Method Detail |
---|
public void setHomeInterface(Class homeInterface)
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.
public void setRefreshHomeOnConnectFailure(boolean refreshHomeOnConnectFailure)
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.
ConnectException
,
ConnectIOException
,
NoSuchObjectException
protected boolean isHomeRefreshable()
AbstractSlsbInvokerInterceptor
isHomeRefreshable
in class AbstractSlsbInvokerInterceptor
protected Object lookup() throws NamingException
lookup
in class JndiObjectLocator
NamingException
- if the JNDI lookup failed or if the
located JNDI object is not assigable to the expected typesetHomeInterface(java.lang.Class)
,
PortableRemoteObject.narrow(java.lang.Object, java.lang.Class)
protected Method getCreateMethod(Object home) throws EjbAccessException
getCreateMethod
in class AbstractSlsbInvokerInterceptor
home
- the EJB home object
EjbAccessException
- if the method couldn't be retrievedpublic Object invoke(MethodInvocation invocation) throws Throwable
Throwable
AbstractSlsbInvokerInterceptor.getHome()
,
doInvoke(org.aopalliance.intercept.MethodInvocation)
,
refreshAndRetry(org.aopalliance.intercept.MethodInvocation)
,
ConnectException
,
ConnectIOException
,
NoSuchObjectException
protected boolean isConnectFailure(RemoteException ex)
ex
- the RMI exception to check
RmiClientInterceptorUtils.isConnectFailure(java.rmi.RemoteException)
protected Object refreshAndRetry(MethodInvocation invocation) throws Throwable
invocation
- the AOP method invocation
Throwable
- in case of invocation failureinvoke(org.aopalliance.intercept.MethodInvocation)
protected abstract Object doInvoke(MethodInvocation invocation) throws Throwable
invocation
- the AOP method invocation
Throwable
- in case of invocation failureAbstractSlsbInvokerInterceptor.getHome()
,
newSessionBeanInstance()
protected EJBObject newSessionBeanInstance() throws NamingException, InvocationTargetException
Can be overridden to change the algorithm.
NamingException
- if thrown by JNDI
InvocationTargetException
- if thrown by the create methodAbstractSlsbInvokerInterceptor.create()
protected void removeSessionBeanInstance(EJBObject ejb)
ejb
- the EJB instance to removeEJBObject.remove()
|
The Spring Framework | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |