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


Java RmiProxyFactoryBean.setRefreshStubOnConnectFailure方法代码示例

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


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

示例1: obtain

import org.springframework.remoting.rmi.RmiProxyFactoryBean; //导入方法依赖的package包/类
/**
 * Utility method to lookup a remote stream peer over RMI.
 */
public static RemoteInputStreamServer obtain(String host, int port, String name) throws RemoteException
{
    RmiProxyFactoryBean rmiProxyFactoryBean = new RmiProxyFactoryBean();
    rmiProxyFactoryBean.setServiceUrl("rmi://" + host + ":" + port + "/" + name);
    rmiProxyFactoryBean.setServiceInterface(RemoteInputStreamServer.class);
    rmiProxyFactoryBean.setRefreshStubOnConnectFailure(true);
    try
    {
        rmiProxyFactoryBean.afterPropertiesSet();
    }
    catch (Exception e)
    {
        throw new RemoteException("Error create rmi proxy");
    }
    return (RemoteInputStreamServer) rmiProxyFactoryBean.getObject();
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:20,代码来源:RmiRemoteInputStreamServer.java

示例2: doRefer

import org.springframework.remoting.rmi.RmiProxyFactoryBean; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
protected <T> T doRefer(final Class<T> serviceType, final URL url) throws RpcException {
    final RmiProxyFactoryBean rmiProxyFactoryBean = new RmiProxyFactoryBean();
    //RMI传输时使用自定义的远程执行对象,从而传递额外的参数
    rmiProxyFactoryBean.setRemoteInvocationFactory(new RemoteInvocationFactory() {
        public RemoteInvocation createRemoteInvocation(MethodInvocation methodInvocation) {
            return new RmiRemoteInvocation(methodInvocation);
        }
    });
    rmiProxyFactoryBean.setServiceUrl(url.toIdentityString());
    rmiProxyFactoryBean.setServiceInterface(serviceType);
    rmiProxyFactoryBean.setCacheStub(true);
    rmiProxyFactoryBean.setLookupStubOnStartup(true);
    rmiProxyFactoryBean.setRefreshStubOnConnectFailure(true);
    rmiProxyFactoryBean.afterPropertiesSet();
    return (T) rmiProxyFactoryBean.getObject();
}
 
开发者ID:hufeng,项目名称:dubbo2.js,代码行数:18,代码来源:RmiProtocol.java

示例3: doRefer

import org.springframework.remoting.rmi.RmiProxyFactoryBean; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
protected <T> T doRefer(final Class<T> serviceType, final URL url) throws RpcException {
    final RmiProxyFactoryBean rmiProxyFactoryBean = new RmiProxyFactoryBean();
    rmiProxyFactoryBean.setServiceUrl(url.toIdentityString());
    rmiProxyFactoryBean.setServiceInterface(serviceType);
    rmiProxyFactoryBean.setCacheStub(true);
    rmiProxyFactoryBean.setLookupStubOnStartup(true);
    rmiProxyFactoryBean.setRefreshStubOnConnectFailure(true);
    rmiProxyFactoryBean.afterPropertiesSet();
    return (T) rmiProxyFactoryBean.getObject();
}
 
开发者ID:dachengxi,项目名称:EatDubbo,代码行数:12,代码来源:RmiProtocol.java

示例4: importService

import org.springframework.remoting.rmi.RmiProxyFactoryBean; //导入方法依赖的package包/类
public static <T> T importService(Class<T> serviceInterface, int port, String serviceName, long timeout, TimeUnit timeunit) {
    long timeoutMs = timeunit.toMillis(timeout);

    String url = "rmi://localhost:" + port + "/" + serviceName;
    log.debug("Creating RMI proxy for " + serviceInterface + " on " + url);
    RmiProxyFactoryBean rmiFactory = new RmiProxyFactoryBean();
    rmiFactory.setServiceInterface(serviceInterface);
    rmiFactory.setServiceUrl(url);
    rmiFactory.setRefreshStubOnConnectFailure(true);
    rmiFactory.setLookupStubOnStartup(true);

    boolean connected = false;
    RuntimeException thrown = null;
    long start = System.currentTimeMillis();
    while (!connected && System.currentTimeMillis() - start < timeoutMs) {
        try {
            rmiFactory.afterPropertiesSet();
            connected = true;
        } catch (RuntimeException e) {
            thrown = e;
            try {
                Thread.sleep(100);
            } catch (InterruptedException e1) {
                throw new RuntimeException("Interrupted while waiting for service to be available", e1);
            }
        }
    }
    if (!connected) {
        throw thrown;
    }

    T serviceProxy = (T) rmiFactory.getObject();
    return serviceProxy;
}
 
开发者ID:cedricvidal,项目名称:jforkr,代码行数:35,代码来源:RmiUtil.java


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