java.lang.Object | |||||
↳ | org.springframework.remoting.support.RemotingSupport | ||||
↳ | org.springframework.remoting.support.RemoteAccessor | ||||
↳ | org.springframework.remoting.support.UrlBasedRemoteAccessor | ||||
↳ | org.springframework.remoting.support.RemoteInvocationBasedAccessor | ||||
↳ | org.springframework.remoting.rmi.RmiClientInterceptor |
Known Direct Subclasses |
org.aopalliance.intercept.MethodInterceptor for accessing conventional RMI services or RMI invokers. The service URL must be a valid RMI URL (e.g. "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.
[Expand]
Inherited Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
org.springframework.remoting.support.RemotingSupport
|
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Invoked by a BeanFactory after it has set all bean properties supplied
(and satisfied BeanFactoryAware and ApplicationContextAware).
| |||||||||||
Fetches an RMI stub and delegates to
doInvoke . | |||||||||||
Fetches RMI stub on startup, if necessary.
| |||||||||||
Set whether to cache the RMI stub once it has been located.
| |||||||||||
Set whether to look up the RMI stub on startup.
| |||||||||||
Set whether to refresh the RMI stub on connect failure.
| |||||||||||
Set a custom RMI client socket factory to use for accessing the RMI registry.
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Apply the given AOP method invocation to the given
RmiInvocationHandler . | |||||||||||
Perform the given invocation on the given RMI stub.
| |||||||||||
Return the RMI stub to use.
| |||||||||||
Determine whether the given RMI exception indicates a connect failure.
| |||||||||||
Create the RMI stub, typically by looking it up.
| |||||||||||
Refresh the RMI stub and retry the given invocation.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
org.springframework.remoting.support.RemoteInvocationBasedAccessor
| |||||||||||
From class
org.springframework.remoting.support.UrlBasedRemoteAccessor
| |||||||||||
From class
org.springframework.remoting.support.RemoteAccessor
| |||||||||||
From class
org.springframework.remoting.support.RemotingSupport
| |||||||||||
From class
java.lang.Object
| |||||||||||
From interface
org.springframework.beans.factory.BeanClassLoaderAware
| |||||||||||
From interface
org.springframework.beans.factory.InitializingBean
|
Invoked by a BeanFactory after it has set all bean properties supplied (and satisfied BeanFactoryAware and ApplicationContextAware).
This method allows the bean instance to perform initialization only possible when all bean properties have been set and to throw an exception in the event of misconfiguration.
Fetches an RMI stub and delegates to doInvoke
.
If configured to refresh on connect failure, it will call
refreshAndRetry(MethodInvocation)
on corresponding RMI exceptions.
Throwable |
---|
getStub()
doInvoke(MethodInvocation, Remote)
refreshAndRetry(MethodInvocation)
Fetches RMI stub on startup, if necessary.
RemoteLookupFailureException | if RMI stub creation failed |
---|
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.
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.
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.
Set a custom RMI client socket factory to use for accessing the RMI registry.
Apply the given AOP method invocation to the given RmiInvocationHandler
.
The default implementation delegates to createRemoteInvocation(MethodInvocation)
.
methodInvocation | the current AOP method invocation |
---|---|
invocationHandler | the RmiInvocationHandler to apply the invocation to |
RemoteException | in case of communication errors |
---|---|
NoSuchMethodException | if the method name could not be resolved |
IllegalAccessException | if the method could not be accessed |
InvocationTargetException | if the method invocation resulted in an exception |
Perform the given invocation on the given RMI stub.
invocation | the AOP method invocation |
---|---|
stub | the RMI stub to invoke |
Throwable | in case of invocation failure |
---|
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.
RemoteLookupFailureException | if RMI stub creation failed |
---|
Determine whether the given RMI exception indicates a connect failure.
The default implementation delegates to
isConnectFailure(RemoteException)
.
ex | the RMI exception to check |
---|
Create the RMI stub, typically by looking it up.
Called on interceptor initialization if "cacheStub" is "true";
else called for each invocation by getStub()
.
The default implementation looks up the service URL via
java.rmi.Naming
. This can be overridden in subclasses.
RemoteLookupFailureException | if RMI stub creation failed |
---|
Refresh the RMI stub and retry the given invocation. Called by invoke on connect failure.
invocation | the AOP method invocation |
---|
Throwable | in case of invocation failure |
---|