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


Java RemoteAccessException类代码示例

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


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

示例1: getErrorCode

import org.springframework.remoting.RemoteAccessException; //导入依赖的package包/类
protected int getErrorCode(Throwable e) {
    if (e instanceof RemoteAccessException) {
        e = e.getCause();
    }
    if (e != null && e.getCause() != null) {
        Class<?> cls = e.getCause().getClass();
        // 是根据测试Case发现的问题,对RpcException.setCode进行设置
        if (SocketTimeoutException.class.equals(cls)) {
            return RpcException.TIMEOUT_EXCEPTION;
        } else if (IOException.class.isAssignableFrom(cls)) {
            return RpcException.NETWORK_EXCEPTION;
        } else if (ClassNotFoundException.class.isAssignableFrom(cls)) {
            return RpcException.SERIALIZATION_EXCEPTION;
        }
    }
    return super.getErrorCode(e);
}
 
开发者ID:dachengxi,项目名称:EatDubbo,代码行数:18,代码来源:RmiProtocol.java

示例2: getErrorCode

import org.springframework.remoting.RemoteAccessException; //导入依赖的package包/类
protected int getErrorCode(Throwable e) {
    if (e instanceof RemoteAccessException) {
        e = e.getCause();
    }
    if (e != null) {
        Class<?> cls = e.getClass();
        // 是根据测试Case发现的问题,对RpcException.setCode进行设置
        if (SocketTimeoutException.class.equals(cls)) {
            return RpcException.TIMEOUT_EXCEPTION;
        } else if (IOException.class.isAssignableFrom(cls)) {
            return RpcException.NETWORK_EXCEPTION;
        } else if (ClassNotFoundException.class.isAssignableFrom(cls)) {
            return RpcException.SERIALIZATION_EXCEPTION;
        }
    }
    return super.getErrorCode(e);
}
 
开发者ID:dachengxi,项目名称:EatDubbo,代码行数:18,代码来源:HttpProtocol.java

示例3: convertRmiAccessException

import org.springframework.remoting.RemoteAccessException; //导入依赖的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

示例4: convertHttpInvokerAccessException

import org.springframework.remoting.RemoteAccessException; //导入依赖的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

示例5: refreshRconPassword

import org.springframework.remoting.RemoteAccessException; //导入依赖的package包/类
/**
 * Crawl through the remote server panel looking for the rcon_password of the given <code>server</code>.
 *
 * @param server a GameServer
 * @return the updated GameServer, or <code>null</code> if the updated rcon_password could not be retrieved
 */
public GameServer refreshRconPassword(GameServer server) {
    if (server == null) {
        return null;
    }
    log.debug("Refreshing RCON data: {}", server.getShortNameAndAddress());
    try {
        // TODO: signal abnormal conditions through incidents instead of just logging
        Map<String, String> result = adminPanelService.getServerConfig(server.getId());
        if (!result.getOrDefault("result", "").equals("")) {
            log.warn("RCON refresh failed for {}: {}", server.getShortNameAndAddress(), result.get("result"));
        }
        server.setRconPassword(result.get("rcon_password")); // can be null if the server is bugged
        server.setSvPassword(result.get("sv_password")); // can be null if the server is bugged
        if (server.getRconPassword() == null || server.getSvPassword() == null) {
            log.warn("RCON refresh with invalid data for {}", server.getShortNameAndAddress());
        }
        server.setLastRconDate(ZonedDateTime.now());
        return gameServerRepository.save(server);
    } catch (RemoteAccessException | IOException e) {
        log.warn("Could not refresh RCON data for {}: {}", server.getShortNameAndAddress(), e.toString());
    }
    return null;
}
 
开发者ID:quanticc,项目名称:ugc-bot-redux,代码行数:30,代码来源:GameServerService.java

示例6: start

import org.springframework.remoting.RemoteAccessException; //导入依赖的package包/类
private GameServer start(GameServer server)
    throws MalformedURLException, RemoteAccessException, SteamCondenserException, TimeoutException {
    if (listenPort == null) {
        listenPort = 7131;
    }
    URL ipCheckUrl = new URL("http://checkip.amazonaws.com");
    try (BufferedReader reader = new BufferedReader(new InputStreamReader(ipCheckUrl.openStream()))) {
        String ip = reader.readLine();
        restartListener();
        gameServerService.rcon(server, Optional.empty(), "logaddress_add " + ip + ":" + listenPort);
        gameServerService.rcon(server, Optional.empty(), "logaddress_del " + ip + ":" + listenPort);
        gameServerService.rcon(server, Optional.empty(), "logaddress_add " + ip + ":" + listenPort);
        eventPublisher.publishEvent(new ConsoleAttachedEvent(server));
    } catch (IOException e) {
        log.warn("Could not read from IP check service: {}", e.toString());
    }
    return server;
}
 
开发者ID:quanticc,项目名称:ugc-bot-redux,代码行数:19,代码来源:ConsoleService.java

示例7: testInvokesMethodOnEjbInstanceWithBusinessInterfaceWithRemoteException

import org.springframework.remoting.RemoteAccessException; //导入依赖的package包/类
@Test
public void testInvokesMethodOnEjbInstanceWithBusinessInterfaceWithRemoteException() throws Exception {
	final RemoteInterface ejb = mock(RemoteInterface.class);
	given(ejb.targetMethod()).willThrow(new RemoteException());

	final String jndiName= "foobar";
	Context mockContext = mockContext(jndiName, ejb);

	SimpleRemoteSlsbInvokerInterceptor si = configuredInterceptor(mockContext, jndiName);

	BusinessInterface target = (BusinessInterface) configuredProxy(si, BusinessInterface.class);
	try {
		target.targetMethod();
		fail("Should have thrown RemoteAccessException");
	}
	catch (RemoteAccessException ex) {
		// expected
	}

	verify(mockContext).close();
	verify(ejb).remove();
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:23,代码来源:SimpleRemoteSlsbInvokerInterceptorTests.java

示例8: hessianProxyFactoryBeanWithAuthenticationAndAccessError

import org.springframework.remoting.RemoteAccessException; //导入依赖的package包/类
@Test
public void hessianProxyFactoryBeanWithAuthenticationAndAccessError() throws Exception {
	HessianProxyFactoryBean factory = new HessianProxyFactoryBean();
	factory.setServiceInterface(ITestBean.class);
	factory.setServiceUrl("http://localhosta/testbean");
	factory.setUsername("test");
	factory.setPassword("bean");
	factory.setOverloadEnabled(true);
	factory.afterPropertiesSet();

	assertTrue("Correct singleton value", factory.isSingleton());
	assertTrue(factory.getObject() instanceof ITestBean);
	ITestBean bean = (ITestBean) factory.getObject();

	exception.expect(RemoteAccessException.class);
	bean.setName("test");
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:18,代码来源:CauchoRemotingTests.java

示例9: hessianProxyFactoryBeanWithCustomProxyFactory

import org.springframework.remoting.RemoteAccessException; //导入依赖的package包/类
@Test
public void hessianProxyFactoryBeanWithCustomProxyFactory() throws Exception {
	TestHessianProxyFactory proxyFactory = new TestHessianProxyFactory();
	HessianProxyFactoryBean factory = new HessianProxyFactoryBean();
	factory.setServiceInterface(ITestBean.class);
	factory.setServiceUrl("http://localhosta/testbean");
	factory.setProxyFactory(proxyFactory);
	factory.setUsername("test");
	factory.setPassword("bean");
	factory.setOverloadEnabled(true);
	factory.afterPropertiesSet();
	assertTrue("Correct singleton value", factory.isSingleton());
	assertTrue(factory.getObject() instanceof ITestBean);
	ITestBean bean = (ITestBean) factory.getObject();

	assertEquals(proxyFactory.user, "test");
	assertEquals(proxyFactory.password, "bean");
	assertTrue(proxyFactory.overloadEnabled);

	exception.expect(RemoteAccessException.class);
	bean.setName("test");
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:23,代码来源:CauchoRemotingTests.java

示例10: burlapProxyFactoryBeanWithAuthenticationAndAccessError

import org.springframework.remoting.RemoteAccessException; //导入依赖的package包/类
@Test
public void burlapProxyFactoryBeanWithAuthenticationAndAccessError() throws Exception {
	BurlapProxyFactoryBean factory = new BurlapProxyFactoryBean();
	factory.setServiceInterface(ITestBean.class);
	factory.setServiceUrl("http://localhosta/testbean");
	factory.setUsername("test");
	factory.setPassword("bean");
	factory.setOverloadEnabled(true);
	factory.afterPropertiesSet();

	assertTrue("Correct singleton value", factory.isSingleton());
	assertTrue(factory.getObject() instanceof ITestBean);
	ITestBean bean = (ITestBean) factory.getObject();

	exception.expect(RemoteAccessException.class);
	bean.setName("test");
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:18,代码来源:CauchoRemotingTests.java

示例11: burlapProxyFactoryBeanWithCustomProxyFactory

import org.springframework.remoting.RemoteAccessException; //导入依赖的package包/类
@Test
public void burlapProxyFactoryBeanWithCustomProxyFactory() throws Exception {
	TestBurlapProxyFactory proxyFactory = new TestBurlapProxyFactory();
	BurlapProxyFactoryBean factory = new BurlapProxyFactoryBean();
	factory.setServiceInterface(ITestBean.class);
	factory.setServiceUrl("http://localhosta/testbean");
	factory.setProxyFactory(proxyFactory);
	factory.setUsername("test");
	factory.setPassword("bean");
	factory.setOverloadEnabled(true);
	factory.afterPropertiesSet();

	assertTrue("Correct singleton value", factory.isSingleton());
	assertTrue(factory.getObject() instanceof ITestBean);
	ITestBean bean = (ITestBean) factory.getObject();

	assertEquals(proxyFactory.user, "test");
	assertEquals(proxyFactory.password, "bean");
	assertTrue(proxyFactory.overloadEnabled);

	exception.expect(RemoteAccessException.class);
	bean.setName("test");
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:24,代码来源:CauchoRemotingTests.java

示例12: handle

import org.springframework.remoting.RemoteAccessException; //导入依赖的package包/类
@Override
public boolean handle(Thread thread, Throwable exception) {
    @SuppressWarnings("unchecked")
    List<Throwable> list = ExceptionUtils.getThrowableList(exception);
    for (Throwable throwable : list) {
        if (throwable instanceof RemoteAccessException) {
            Messages messages = AppBeans.get(Messages.NAME);
            String msg = messages.getMessage(getClass(), "connectException.message");
            if (throwable.getCause() == null) {
                App.getInstance().getMainFrame().showNotification(msg, Frame.NotificationType.ERROR);
            } else {
                String description = messages.formatMessage(getClass(), "connectException.description",
                        throwable.getCause().toString());
                App.getInstance().getMainFrame().showNotification(msg, description, Frame.NotificationType.ERROR);
            }
            return true;
        }
    }
    return false;
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:21,代码来源:ConnectExceptionHandler.java

示例13: exit

import org.springframework.remoting.RemoteAccessException; //导入依赖的package包/类
protected void exit() {
    try {
        userActionsLog.trace("Closing application...");
        if (connection.isConnected()) {
            recursiveClosingFrames(topLevelFrames.iterator(), () -> {
                exiting = true;
                connection.logout();
                forceExit();
            });
        } else {
            forceExit();
        }
    } catch (Throwable e) {
        log.warn("Error closing application", e);
        String title = messages.getMainMessage("errorPane.title");
        String text = messages.getMainMessage("unexpectedCloseException.message") + "\n";
        if (e instanceof RemoteAccessException) {
            text = text + messages.getMainMessage("connectException.message");
        } else {
            text = text + e.getClass().getSimpleName() + ": " + e.getMessage();
        }
        JOptionPane.showMessageDialog(mainFrame, text, title, JOptionPane.WARNING_MESSAGE);
        forceExit();
    }
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:26,代码来源:App.java


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