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


Java RegistryDirectory.setRegistry方法代码示例

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


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

示例1: createRegistry

import com.alibaba.dubbo.registry.integration.RegistryDirectory; //导入方法依赖的package包/类
public Registry createRegistry(URL url) {
    url = getRegistryURL(url);
    List<URL> urls = new ArrayList<URL>();
    urls.add(url.removeParameter(Constants.BACKUP_KEY));
    String backup = url.getParameter(Constants.BACKUP_KEY);
    if (backup != null && backup.length() > 0) {
        String[] addresses = Constants.COMMA_SPLIT_PATTERN.split(backup);
        for (String address : addresses) {
            urls.add(url.setAddress(address));
        }
    }
    RegistryDirectory<RegistryService> directory = new RegistryDirectory<RegistryService>(RegistryService.class, url.addParameter(Constants.INTERFACE_KEY, RegistryService.class.getName()).addParameterAndEncoded(Constants.REFER_KEY, url.toParameterString()));
    Invoker<RegistryService> registryInvoker = cluster.join(directory);
    RegistryService registryService = proxyFactory.getProxy(registryInvoker);
    DubboRegistry registry = new DubboRegistry(registryInvoker, registryService);
    directory.setRegistry(registry);
    directory.setProtocol(protocol);
    directory.notify(urls);
    directory.subscribe(new URL(Constants.CONSUMER_PROTOCOL, NetUtils.getLocalHost(), 0, RegistryService.class.getName(), url.getParameters()));
    return registry;
}
 
开发者ID:dachengxi,项目名称:EatDubbo,代码行数:22,代码来源:DubboRegistryFactory.java

示例2: testDestroy_WithDestroyRegistry

import com.alibaba.dubbo.registry.integration.RegistryDirectory; //导入方法依赖的package包/类
@Test
public void testDestroy_WithDestroyRegistry() {
    RegistryDirectory registryDirectory = getRegistryDirectory();
    CountDownLatch latch = new CountDownLatch(1);
    registryDirectory.setRegistry(new MockRegistry(latch));
    registryDirectory.subscribe(URL.valueOf("consumer://" + NetUtils.getLocalHost() + "/DemoService?category=providers"));
    registryDirectory.destroy();
    Assert.assertEquals(0, latch.getCount());
}
 
开发者ID:dachengxi,项目名称:EatDubbo,代码行数:10,代码来源:RegistryDirectoryTest.java

示例3: testDestroy_WithDestroyRegistry_WithError

import com.alibaba.dubbo.registry.integration.RegistryDirectory; //导入方法依赖的package包/类
@Test
public void testDestroy_WithDestroyRegistry_WithError() {
    RegistryDirectory registryDirectory = getRegistryDirectory();
    registryDirectory.setRegistry(new MockRegistry(true));
    registryDirectory.destroy();
}
 
开发者ID:dachengxi,项目名称:EatDubbo,代码行数:7,代码来源:RegistryDirectoryTest.java


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