| org.springframework.remoting.support.RemoteInvocationBasedAccessor org.springframework.remoting.rmi.RmiClientInterceptor
All known Subclasses: org.springframework.remoting.rmi.RmiProxyFactoryBean,
RmiClientInterceptor | public class RmiClientInterceptor extends RemoteInvocationBasedAccessor implements MethodInterceptor(Code) | | Interceptor for accessing conventional RMI services or RMI invokers.
The service URL must be a valid RMI URL like "rmi://localhost:1099/myservice".
RMI invokers work at the RmiInvocationHandler level, needing only one stub for
any service. Service interfaces do not have to extend java.rmi.Remote
or throw java.rmi.RemoteException . Spring's unchecked
RemoteAccessException will be thrown on remote invocation failure.
Of course, in and out parameters have to be serializable.
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.
author: Juergen Hoeller since: 29.09.2003 See Also: RmiServiceExporter See Also: RmiProxyFactoryBean See Also: RmiInvocationHandler See Also: org.springframework.remoting.RemoteAccessException See Also: java.rmi.RemoteException See Also: java.rmi.Remote |
afterPropertiesSet | public void afterPropertiesSet()(Code) | | |
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 |
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 |
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: RmiClientInterceptor.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: RmiClientInterceptor.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: RmiClientInterceptor.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 |
|
|