Java Code Examples for java.rmi.RemoteException.getCause()

The following are Jave code examples for showing how to use getCause() of the java.rmi.RemoteException class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: lams   File: RmiClientInterceptorUtils.java   Source Code and License Vote up 3 votes
/**
 * Determine whether the given RMI exception indicates a connect failure.
 * <p>Treats RMI's ConnectException, ConnectIOException, UnknownHostException,
 * NoSuchObjectException and StubNotFoundException as connect failure.
 * @param ex the RMI exception to check
 * @return whether the exception should be treated as connect failure
 * @see java.rmi.ConnectException
 * @see java.rmi.ConnectIOException
 * @see java.rmi.UnknownHostException
 * @see java.rmi.NoSuchObjectException
 * @see java.rmi.StubNotFoundException
 */
public static boolean isConnectFailure(RemoteException ex) {
	return (ex instanceof ConnectException || ex instanceof ConnectIOException ||
			ex instanceof UnknownHostException || ex instanceof NoSuchObjectException ||
			ex instanceof StubNotFoundException || ex.getCause() instanceof SocketException ||
			isCorbaConnectFailure(ex.getCause()));
}