List of usage examples for org.springframework.remoting.rmi RmiProxyFactoryBean setRefreshStubOnConnectFailure
public void setRefreshStubOnConnectFailure(boolean refreshStubOnConnectFailure)
From source file:com.mysoft.b2b.event.scheduler.protocol.rmi.RMIClientHelper.java
public static ProtocolService getRMIProtocolService(String protocolUrl) { String serviceUrl = ""; if (protocolUrl != null && protocolUrl.endsWith("/")) { serviceUrl = protocolUrl;// w ww . j a v a 2 s.co m } else { serviceUrl = protocolUrl + "/"; } serviceUrl = serviceUrl + ProtocolService.class.getSimpleName(); RmiProxyFactoryBean rpfb = new RmiProxyFactoryBean(); rpfb.setServiceUrl(serviceUrl); rpfb.setServiceInterface(ProtocolService.class); try { rpfb.setLookupStubOnStartup(false); rpfb.setRefreshStubOnConnectFailure(true); rpfb.afterPropertiesSet(); } catch (Exception e) { logger.info("Can't get the remote RMI server: " + serviceUrl + ", because " + e.getMessage()); return null; } logger.info("Success to init RMI local proxy service for " + serviceUrl); return (ProtocolService) rpfb.getObject(); }