public abstract class AbstractRemoteSlsbInvokerInterceptor extends AbstractSlsbInvokerInterceptor
Such an interceptor must be the last interceptor in the advice chain. In this case, there is no target object.
CONTAINER_PREFIX
logger
Constructor and Description |
---|
AbstractRemoteSlsbInvokerInterceptor() |
Modifier and Type | Method and Description |
---|---|
protected abstract Object |
doInvoke(org.aopalliance.intercept.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 |
invokeInContext(org.aopalliance.intercept.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 |
newSessionBeanInstance()
Return a new instance of the stateless session bean.
|
protected Object |
refreshAndRetry(org.aopalliance.intercept.MethodInvocation invocation)
Refresh the EJB home object and retry the given invocation.
|
protected void |
removeSessionBeanInstance(EJBObject ejb)
Remove the given EJB instance.
|
void |
setRefreshHomeOnConnectFailure(boolean refreshHomeOnConnectFailure)
Set whether to refresh the EJB home on connect failure.
|
afterPropertiesSet, create, getHome, invoke, refreshHome, setCacheHome, setExposeAccessContext, setLookupHomeOnStartup
getExpectedType, getJndiName, lookup, setExpectedType, setJndiName
convertJndiName, isResourceRef, lookup, lookup, setResourceRef
getJndiEnvironment, getJndiTemplate, setJndiEnvironment, setJndiTemplate
public AbstractRemoteSlsbInvokerInterceptor()
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 Method getCreateMethod(Object home) throws EjbAccessException
getCreateMethod
in class AbstractSlsbInvokerInterceptor
home
- the EJB home objectEjbAccessException
- if the method couldn't be retrieved@Nullable public Object invokeInContext(org.aopalliance.intercept.MethodInvocation invocation) throws Throwable
doInvoke
.
If configured to refresh on connect failure, it will call
refreshAndRetry(org.aopalliance.intercept.MethodInvocation)
on corresponding RMI exceptions.
invokeInContext
in class AbstractSlsbInvokerInterceptor
invocation
- the AOP method invocationThrowable
- in case of invocation failureAbstractSlsbInvokerInterceptor.getHome()
,
doInvoke(org.aopalliance.intercept.MethodInvocation)
,
refreshAndRetry(org.aopalliance.intercept.MethodInvocation)
protected boolean isConnectFailure(RemoteException ex)
The default implementation delegates to RmiClientInterceptorUtils.
ex
- the RMI exception to checkRmiClientInterceptorUtils.isConnectFailure(java.rmi.RemoteException)
@Nullable protected Object refreshAndRetry(org.aopalliance.intercept.MethodInvocation invocation) throws Throwable
invocation
- the AOP method invocationThrowable
- in case of invocation failureAbstractSlsbInvokerInterceptor.invoke(org.aopalliance.intercept.MethodInvocation)
@Nullable protected abstract Object doInvoke(org.aopalliance.intercept.MethodInvocation invocation) throws Throwable
invocation
- the AOP method invocationThrowable
- in case of invocation failureAbstractSlsbInvokerInterceptor.getHome()
,
newSessionBeanInstance()
protected Object newSessionBeanInstance() throws NamingException, InvocationTargetException
Can be overridden to change the algorithm.
NamingException
- if thrown by JNDIInvocationTargetException
- if thrown by the create methodAbstractSlsbInvokerInterceptor.create()
protected void removeSessionBeanInstance(@Nullable EJBObject ejb)
ejb
- the EJB instance to removeEJBObject.remove()