|
The Spring Framework | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.remoting.rmi.RmiClientInterceptorUtils
public abstract class RmiClientInterceptorUtils
Factored-out methods for performing invocations within an RMI client. Can handle both RMI and non-RMI service interfaces working on an RMI stub.
Note: This is an SPI class, not intended to be used by applications.
Constructor Summary | |
---|---|
RmiClientInterceptorUtils()
|
Method Summary | |
---|---|
static Exception |
convertRmiAccessException(Method method,
RemoteException ex,
boolean isConnectFailure,
String serviceName)
Convert the given RemoteException that happened during remote access to Spring's RemoteAccessException if the method signature does not support RemoteException. |
static Exception |
convertRmiAccessException(Method method,
RemoteException ex,
String serviceName)
Convert the given RemoteException that happened during remote access to Spring's RemoteAccessException if the method signature does not support RemoteException. |
static Exception |
convertRmiAccessException(Method method,
Throwable ex,
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 Object |
doInvoke(MethodInvocation invocation,
Remote stub)
Perform a raw method invocation on the given RMI stub, letting reflection exceptions through as-is. |
static Object |
invoke(MethodInvocation invocation,
Remote stub,
String serviceName)
Apply the given method invocation to the given RMI stub. |
static boolean |
isConnectFailure(RemoteException ex)
Determine whether the given RMI exception indicates a connect failure. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public RmiClientInterceptorUtils()
Method Detail |
---|
public static Object invoke(MethodInvocation invocation, Remote stub, String serviceName) throws Throwable
Delegate to the corresponding method if the RMI stub does not directly
implemented the invoked method. This typically happens when a non-RMI service
interface is used for an RMI service. The methods of such a service interface
have to match the RMI stub methods, but they typically don't declare
java.rmi.RemoteException
: A RemoteException thrown by the RMI stub
will be automatically converted to Spring's RemoteAccessException.
invocation
- the AOP MethodInvocationstub
- the RMI stubserviceName
- the name of the service (for debugging purposes)
Throwable
- exception to be thrown to the callerRemoteException
,
RemoteAccessException
public static Object doInvoke(MethodInvocation invocation, Remote stub) throws InvocationTargetException
invocation
- the AOP MethodInvocationstub
- the RMI stub
InvocationTargetException
- if thrown by reflectionpublic static Exception convertRmiAccessException(Method method, Throwable ex, 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
RemoteException
public static Exception convertRmiAccessException(Method method, RemoteException ex, String serviceName)
method
- the invoked methodex
- the RemoteException that happenedserviceName
- the name of the service (for debugging purposes)
public static Exception convertRmiAccessException(Method method, RemoteException ex, boolean isConnectFailure, 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(RemoteException ex)
Treats RMI's ConnectException, ConnectIOException, UnknownHostException,
NoSuchObjectException, StubNotFoundException, MarshalException and
UnmarshalException as connect failure, as well as Oracle's OC4J
com.evermind.server.rmi.RMIConnectionException
(which doesn't derive from from any well-known RMI connect exception).
ex
- the RMI exception to check
ConnectException
,
ConnectIOException
,
UnknownHostException
,
NoSuchObjectException
,
StubNotFoundException
,
MarshalException
,
UnmarshalException
|
The Spring Framework | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |