| org.springframework.jndi.JndiObjectLocator org.springframework.remoting.rmi.JndiRmiClientInterceptor
All known Subclasses: org.springframework.remoting.rmi.JndiRmiProxyFactoryBean,
JndiRmiClientInterceptor | public class JndiRmiClientInterceptor extends JndiObjectLocator implements MethodInterceptor,InitializingBean(Code) | | org.aopalliance.intercept.MethodInterceptor for accessing RMI services from JNDI.
Typically used for RMI-IIOP (CORBA), but can also be used for EJB home objects
(for example, a Stateful Session Bean home). In contrast to a plain JNDI lookup,
this accessor also performs narrowing through PortableRemoteObject.
With conventional RMI services, this invoker is typically used with the RMI
service interface. Alternatively, this invoker can also proxy a remote RMI service
with a matching non-RMI business interface, i.e. an interface that mirrors the RMI
service methods but does not declare RemoteExceptions. In the latter case,
RemoteExceptions thrown by the RMI stub will automatically get converted to
Spring's unchecked RemoteAccessException.
The JNDI environment can be specified as "jndiEnvironment" property,
or be configured in a jndi.properties file or as system properties.
For example:
<property name="jndiEnvironment">
<props>
<prop key="java.naming.factory.initial">com.sun.jndi.cosnaming.CNCtxFactory</prop>
<prop key="java.naming.provider.url">iiop://localhost:1050</prop>
</props>
</property>
author: Juergen Hoeller since: 1.1 See Also: JndiRmiClientInterceptor.setJndiTemplate See Also: JndiRmiClientInterceptor.setJndiEnvironment See Also: JndiRmiClientInterceptor.setJndiName See Also: JndiRmiServiceExporter See Also: JndiRmiProxyFactoryBean See Also: org.springframework.remoting.RemoteAccessException See Also: java.rmi.RemoteException See Also: java.rmi.Remote See Also: javax.rmi.PortableRemoteObject.narrow |
createRemoteInvocation | protected RemoteInvocation createRemoteInvocation(MethodInvocation methodInvocation)(Code) | | Create a new RemoteInvocation object for the given AOP method invocation.
The default implementation delegates to the configured
JndiRmiClientInterceptor.setRemoteInvocationFactory RemoteInvocationFactory .
This can be overridden in subclasses in order to provide custom RemoteInvocation
subclasses, containing additional invocation parameters (e.g. user credentials).
Note that it is preferable to build a custom RemoteInvocationFactory
as a reusable strategy, instead of overriding this method.
Parameters: methodInvocation - the current AOP method invocation the RemoteInvocation object See Also: RemoteInvocationFactory.createRemoteInvocation |
doInvoke | protected Object doInvoke(MethodInvocation invocation, Remote stub) throws Throwable(Code) | | Perform the given invocation on the given RMI stub.
Parameters: invocation - the AOP method invocation Parameters: stub - the RMI stub to invoke the invocation result, if any throws: Throwable - in case of invocation failure |
getRemoteInvocationFactory | public RemoteInvocationFactory getRemoteInvocationFactory()(Code) | | Return the RemoteInvocationFactory used by this accessor.
|
getServiceInterface | public Class getServiceInterface()(Code) | | Return the interface of the service to access.
|
isConnectFailure | protected boolean isConnectFailure(RemoteException ex)(Code) | | Determine whether the given RMI exception indicates a connect failure.
The default implementation delegates to
RmiClientInterceptorUtils.isConnectFailure .
Parameters: ex - the RMI exception to check whether the exception should be treated as connect failure |
isConnectFailure | protected boolean isConnectFailure(SystemException ex)(Code) | | Determine whether the given CORBA exception indicates a connect failure.
The default implementation checks for CORBA's
org.omg.CORBA.OBJECT_NOT_EXIST exception.
Parameters: ex - the RMI exception to check whether the exception should be treated as connect failure |
refreshAndRetry | protected Object refreshAndRetry(MethodInvocation invocation) throws Throwable(Code) | | Refresh the RMI stub and retry the given invocation.
Called by invoke on connect failure.
Parameters: invocation - the AOP method invocation the invocation result, if any throws: Throwable - in case of invocation failure See Also: JndiRmiClientInterceptor.invoke |
setCacheStub | public void setCacheStub(boolean cacheStub)(Code) | | Set whether to cache the RMI stub once it has been located.
Default is "true".
Can be turned off to allow for hot restart of the RMI server.
In this case, the RMI stub will be fetched for each invocation.
See Also: JndiRmiClientInterceptor.setLookupStubOnStartup |
setLookupStubOnStartup | public void setLookupStubOnStartup(boolean lookupStubOnStartup)(Code) | | Set whether to look up the RMI stub on startup. Default is "true".
Can be turned off to allow for late start of the RMI server.
In this case, the RMI stub will be fetched on first access.
See Also: JndiRmiClientInterceptor.setCacheStub |
setRefreshStubOnConnectFailure | public void setRefreshStubOnConnectFailure(boolean refreshStubOnConnectFailure)(Code) | | Set whether to refresh the RMI stub on connect failure.
Default is "false".
Can be turned on to allow for hot restart of the RMI server.
If a cached RMI stub throws an RMI exception that indicates a
remote connect failure, a fresh proxy will be fetched and the
invocation will be retried.
See Also: java.rmi.ConnectException See Also: java.rmi.ConnectIOException See Also: java.rmi.NoSuchObjectException |
setRemoteInvocationFactory | public void setRemoteInvocationFactory(RemoteInvocationFactory remoteInvocationFactory)(Code) | | Set the RemoteInvocationFactory to use for this accessor.
Default is a
DefaultRemoteInvocationFactory .
A custom invocation factory can add further context information
to the invocation, for example user credentials.
|
setServiceInterface | public void setServiceInterface(Class serviceInterface)(Code) | | Set the interface of the service to access.
The interface must be suitable for the particular service and remoting tool.
Typically required to be able to create a suitable service proxy,
but can also be optional if the lookup returns a typed stub.
|
|
|