当前位置: 首页>>代码示例>>Java>>正文


Java RemoteConnectFailureException类代码示例

本文整理汇总了Java中org.springframework.remoting.RemoteConnectFailureException的典型用法代码示例。如果您正苦于以下问题:Java RemoteConnectFailureException类的具体用法?Java RemoteConnectFailureException怎么用?Java RemoteConnectFailureException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


RemoteConnectFailureException类属于org.springframework.remoting包,在下文中一共展示了RemoteConnectFailureException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: convertRmiAccessException

import org.springframework.remoting.RemoteConnectFailureException; //导入依赖的package包/类
/**
 * Convert the given RemoteException that happened during remote access
 * to Spring's RemoteAccessException if the method signature does not
 * support RemoteException. Else, return the original RemoteException.
 * @param method the invoked method
 * @param ex the RemoteException that happened
 * @param isConnectFailure whether the given exception should be considered
 * a connect failure
 * @param serviceName the name of the service (for debugging purposes)
 * @return the exception to be thrown to the caller
 */
public static Exception convertRmiAccessException(
		Method method, RemoteException ex, boolean isConnectFailure, String serviceName) {

	if (logger.isDebugEnabled()) {
		logger.debug("Remote service [" + serviceName + "] threw exception", ex);
	}
	if (ReflectionUtils.declaresException(method, ex.getClass())) {
		return ex;
	}
	else {
		if (isConnectFailure) {
			return new RemoteConnectFailureException("Could not connect to remote service [" + serviceName + "]", ex);
		}
		else {
			return new RemoteAccessException("Could not access remote service [" + serviceName + "]", ex);
		}
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:30,代码来源:RmiClientInterceptorUtils.java

示例2: convertHttpInvokerAccessException

import org.springframework.remoting.RemoteConnectFailureException; //导入依赖的package包/类
/**
 * Convert the given HTTP invoker access exception to an appropriate
 * Spring RemoteAccessException.
 * @param ex the exception to convert
 * @return the RemoteAccessException to throw
 */
protected RemoteAccessException convertHttpInvokerAccessException(Throwable ex) {
	if (ex instanceof ConnectException) {
		return new RemoteConnectFailureException(
				"Could not connect to HTTP invoker remote service at [" + getServiceUrl() + "]", ex);
	}

	if (ex instanceof ClassNotFoundException || ex instanceof NoClassDefFoundError ||
			ex instanceof InvalidClassException) {
		return new RemoteAccessException(
				"Could not deserialize result from HTTP invoker remote service [" + getServiceUrl() + "]", ex);
	}

	return new RemoteAccessException(
				"Could not access HTTP invoker remote service at [" + getServiceUrl() + "]", ex);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:22,代码来源:HttpInvokerClientInterceptor.java

示例3: convertHessianAccessException

import org.springframework.remoting.RemoteConnectFailureException; //导入依赖的package包/类
/**
 * Convert the given Hessian access exception to an appropriate
 * Spring RemoteAccessException.
 * @param ex the exception to convert
 * @return the RemoteAccessException to throw
 */
protected RemoteAccessException convertHessianAccessException(Throwable ex) {
	if (ex instanceof HessianConnectionException || ex instanceof ConnectException) {
		return new RemoteConnectFailureException(
				"Cannot connect to Hessian remote service at [" + getServiceUrl() + "]", ex);
	}
	else {
		return new RemoteAccessException(
			"Cannot access Hessian remote service at [" + getServiceUrl() + "]", ex);
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:17,代码来源:HessianClientInterceptor.java

示例4: convertBurlapAccessException

import org.springframework.remoting.RemoteConnectFailureException; //导入依赖的package包/类
/**
 * Convert the given Burlap access exception to an appropriate
 * Spring RemoteAccessException.
 * @param ex the exception to convert
 * @return the RemoteAccessException to throw
 */
protected RemoteAccessException convertBurlapAccessException(Throwable ex) {
	if (ex instanceof ConnectException) {
		return new RemoteConnectFailureException(
				"Cannot connect to Burlap remote service at [" + getServiceUrl() + "]", ex);
	}
	else {
		return new RemoteAccessException(
			"Cannot access Burlap remote service at [" + getServiceUrl() + "]", ex);
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:17,代码来源:BurlapClientInterceptor.java

示例5: convertCorbaAccessException

import org.springframework.remoting.RemoteConnectFailureException; //导入依赖的package包/类
/**
 * Convert the given CORBA SystemException that happened during remote access
 * to Spring's RemoteAccessException if the method signature does not declare
 * RemoteException. Else, return the SystemException wrapped in a RemoteException.
 * @param method the invoked method
 * @param ex the RemoteException that happened
 * @return the exception to be thrown to the caller
 */
private Exception convertCorbaAccessException(SystemException ex, Method method) {
	if (ReflectionUtils.declaresException(method, RemoteException.class)) {
		// A traditional RMI service: wrap CORBA exceptions in standard RemoteExceptions.
		return new RemoteException("Failed to access CORBA service [" + getJndiName() + "]", ex);
	}
	else {
		if (isConnectFailure(ex)) {
			return new RemoteConnectFailureException("Could not connect to CORBA service [" + getJndiName() + "]", ex);
		}
		else {
			return new RemoteAccessException("Could not access CORBA service [" + getJndiName() + "]", ex);
		}
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:23,代码来源:JndiRmiClientInterceptor.java

示例6: doTestRmiProxyFactoryBeanWithBusinessInterfaceAndExceptionAndRefresh

import org.springframework.remoting.RemoteConnectFailureException; //导入依赖的package包/类
private void doTestRmiProxyFactoryBeanWithBusinessInterfaceAndExceptionAndRefresh(
		Class<?> rmiExceptionClass, Class<?> springExceptionClass) throws Exception {

	CountingRmiProxyFactoryBean factory = new CountingRmiProxyFactoryBean();
	factory.setServiceInterface(IBusinessBean.class);
	factory.setServiceUrl("rmi://localhost:1090/test");
	factory.setRefreshStubOnConnectFailure(true);
	factory.afterPropertiesSet();
	assertTrue(factory.getObject() instanceof IBusinessBean);
	IBusinessBean proxy = (IBusinessBean) factory.getObject();
	assertFalse(proxy instanceof IRemoteBean);
	try {
		proxy.setName(rmiExceptionClass.getName());
		fail("Should have thrown " + rmiExceptionClass.getName());
	}
	catch (Exception ex) {
		if (springExceptionClass.isInstance(ex)) {
			// expected
		}
		else {
			throw ex;
		}
	}
	if (RemoteConnectFailureException.class.isAssignableFrom(springExceptionClass)) {
		assertEquals(2, factory.counter);
	}
	else {
		assertEquals(1, factory.counter);
	}
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:31,代码来源:RmiSupportTests.java

示例7: convertSimpleXmlInvokerAccessException

import org.springframework.remoting.RemoteConnectFailureException; //导入依赖的package包/类
protected RemoteAccessException convertSimpleXmlInvokerAccessException(Throwable ex) {
    if (ex instanceof ConnectException) {
        throw new RemoteConnectFailureException(
                "Could not connect to HTTP invoker remote service at [" + getServiceUrl() + "]", ex);
    } else if (ex instanceof ClassNotFoundException || ex instanceof NoClassDefFoundError || ex instanceof InvalidClassException) {
        throw new RemoteAccessException(
                "Could not deserialize result from HTTP invoker remote service [" + getServiceUrl() + "]", ex);
    } else {
        throw new RemoteAccessException(
                "Could not access HTTP invoker remote service at [" + getServiceUrl() + "]", ex);
    }
}
 
开发者ID:shevek,项目名称:simple-xml-serializers,代码行数:13,代码来源:SimpleXmlInvokerClientInterceptor.java

示例8: shouldTimeoutBefore5sWithStandaloneClient

import org.springframework.remoting.RemoteConnectFailureException; //导入依赖的package包/类
@Test(expected = RemoteConnectFailureException.class)
public void shouldTimeoutBefore5sWithStandaloneClient() throws Exception {

    // given
    TimeoutService timeoutClient = getStandaloneTimeoutClient();

    // when
    timeoutClient.helloAfter5s();

    // then
    fail("Timeout should have caused exception");
}
 
开发者ID:PayU-Tech,项目名称:Ratel,代码行数:13,代码来源:FactoryTimeoutConfigurationTest.java

示例9: shouldTimeoutBefore5sWithInjectedClient

import org.springframework.remoting.RemoteConnectFailureException; //导入依赖的package包/类
@Test(expected = RemoteConnectFailureException.class)
public void shouldTimeoutBefore5sWithInjectedClient() throws Exception {
    // when
    timeoutService.helloAfter5s();

    // then
    fail("Timeout should have caused exception");
}
 
开发者ID:PayU-Tech,项目名称:Ratel,代码行数:9,代码来源:PropertiesTimeoutConfigurationTest.java

示例10: notifyClientsForUpdate

import org.springframework.remoting.RemoteConnectFailureException; //导入依赖的package包/类
@Override
public void notifyClientsForUpdate() {
	for (EM entityModel : entityModels) {
		try {
			entityModel.update();
		} catch (RemoteConnectFailureException e) {
			entityModels.remove(entityModel);
		}
	}
}
 
开发者ID:DevOpsDistilled,项目名称:OpERP,代码行数:11,代码来源:AbstractEntityService.java

示例11: rmiProxyFactoryBeanWithBusinessInterfaceAndConnectException

import org.springframework.remoting.RemoteConnectFailureException; //导入依赖的package包/类
@Test
public void rmiProxyFactoryBeanWithBusinessInterfaceAndConnectException() throws Exception {
	doTestRmiProxyFactoryBeanWithBusinessInterfaceAndException(
			ConnectException.class, RemoteConnectFailureException.class);
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:6,代码来源:RmiSupportTests.java

示例12: rmiProxyFactoryBeanWithBusinessInterfaceAndConnectIOException

import org.springframework.remoting.RemoteConnectFailureException; //导入依赖的package包/类
@Test
public void rmiProxyFactoryBeanWithBusinessInterfaceAndConnectIOException() throws Exception {
	doTestRmiProxyFactoryBeanWithBusinessInterfaceAndException(
			ConnectIOException.class, RemoteConnectFailureException.class);
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:6,代码来源:RmiSupportTests.java

示例13: rmiProxyFactoryBeanWithBusinessInterfaceAndUnknownHostException

import org.springframework.remoting.RemoteConnectFailureException; //导入依赖的package包/类
@Test
public void rmiProxyFactoryBeanWithBusinessInterfaceAndUnknownHostException() throws Exception {
	doTestRmiProxyFactoryBeanWithBusinessInterfaceAndException(
			UnknownHostException.class, RemoteConnectFailureException.class);
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:6,代码来源:RmiSupportTests.java

示例14: rmiProxyFactoryBeanWithBusinessInterfaceAndNoSuchObjectExceptionException

import org.springframework.remoting.RemoteConnectFailureException; //导入依赖的package包/类
@Test
public void rmiProxyFactoryBeanWithBusinessInterfaceAndNoSuchObjectExceptionException() throws Exception {
	doTestRmiProxyFactoryBeanWithBusinessInterfaceAndException(
			NoSuchObjectException.class, RemoteConnectFailureException.class);
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:6,代码来源:RmiSupportTests.java

示例15: rmiProxyFactoryBeanWithBusinessInterfaceAndStubNotFoundException

import org.springframework.remoting.RemoteConnectFailureException; //导入依赖的package包/类
@Test
public void rmiProxyFactoryBeanWithBusinessInterfaceAndStubNotFoundException() throws Exception {
	doTestRmiProxyFactoryBeanWithBusinessInterfaceAndException(
			StubNotFoundException.class, RemoteConnectFailureException.class);
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:6,代码来源:RmiSupportTests.java


注:本文中的org.springframework.remoting.RemoteConnectFailureException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。