MethodInterceptor for accessing conventional
RMI services or RMI invokers. The service URL must be a valid RMI URL
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.
public void setRefreshStubOnConnectFailure(boolean refreshStubOnConnectFailure)
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.
Return the RMI stub to use. Called for each invocation.
The default implementation returns the stub created on initialization,
if any. Else, it invokes lookupStub() to get a new stub for
each invocation. This can be overridden in subclasses, for example in
order to cache a stub for a given amount of time before recreating it,
or to test the stub whether it is still alive.