public abstract class RmiClientInterceptorUtils
extends java.lang.Object
Note: This is an SPI class, not intended to be used by applications.
Constructor and Description |
---|
RmiClientInterceptorUtils() |
Modifier and Type | Method and Description |
---|---|
static java.lang.Exception |
convertRmiAccessException(java.lang.reflect.Method method,
java.rmi.RemoteException ex,
boolean isConnectFailure,
java.lang.String serviceName)
Convert the given RemoteException that happened during remote access
to Spring's RemoteAccessException if the method signature does not
support RemoteException.
|
static java.lang.Exception |
convertRmiAccessException(java.lang.reflect.Method method,
java.rmi.RemoteException ex,
java.lang.String serviceName)
Convert the given RemoteException that happened during remote access
to Spring's RemoteAccessException if the method signature does not
support RemoteException.
|
static java.lang.Exception |
convertRmiAccessException(java.lang.reflect.Method method,
java.lang.Throwable ex,
java.lang.String message)
Wrap the given arbitrary exception that happened during remote access
in either a RemoteException or a Spring RemoteAccessException (if the
method signature does not support RemoteException).
|
static java.lang.Object |
invokeRemoteMethod(MethodInvocation invocation,
java.lang.Object stub)
Perform a raw method invocation on the given RMI stub,
letting reflection exceptions through as-is.
|
static boolean |
isConnectFailure(java.rmi.RemoteException ex)
Determine whether the given RMI exception indicates a connect failure.
|
public static java.lang.Object invokeRemoteMethod(MethodInvocation invocation, java.lang.Object stub) throws java.lang.reflect.InvocationTargetException
invocation
- the AOP MethodInvocationstub
- the RMI stubjava.lang.reflect.InvocationTargetException
- if thrown by reflectionpublic static java.lang.Exception convertRmiAccessException(java.lang.reflect.Method method, java.lang.Throwable ex, java.lang.String message)
Only call this for remote access exceptions, not for exceptions thrown by the target service itself!
method
- the invoked methodex
- the exception that happened, to be used as cause for the
RemoteAccessException or RemoteExceptionmessage
- the message for the RemoteAccessException respectively
RemoteExceptionpublic static java.lang.Exception convertRmiAccessException(java.lang.reflect.Method method, java.rmi.RemoteException ex, java.lang.String serviceName)
method
- the invoked methodex
- the RemoteException that happenedserviceName
- the name of the service (for debugging purposes)public static java.lang.Exception convertRmiAccessException(java.lang.reflect.Method method, java.rmi.RemoteException ex, boolean isConnectFailure, java.lang.String serviceName)
method
- the invoked methodex
- the RemoteException that happenedisConnectFailure
- whether the given exception should be considered
a connect failureserviceName
- the name of the service (for debugging purposes)public static boolean isConnectFailure(java.rmi.RemoteException ex)
Treats RMI's ConnectException, ConnectIOException, UnknownHostException, NoSuchObjectException and StubNotFoundException as connect failure.
ex
- the RMI exception to checkConnectException
,
ConnectIOException
,
UnknownHostException
,
NoSuchObjectException
,
StubNotFoundException