本文整理汇总了Java中com.alibaba.dubbo.registry.integration.RegistryProtocol.export方法的典型用法代码示例。如果您正苦于以下问题:Java RegistryProtocol.export方法的具体用法?Java RegistryProtocol.export怎么用?Java RegistryProtocol.export使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.alibaba.dubbo.registry.integration.RegistryProtocol
的用法示例。
在下文中一共展示了RegistryProtocol.export方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testExport
import com.alibaba.dubbo.registry.integration.RegistryProtocol; //导入方法依赖的package包/类
@Test
public void testExport() {
RegistryProtocol registryProtocol = new RegistryProtocol();
registryProtocol.setCluster(new FailfastCluster());
registryProtocol.setRegistryFactory(ExtensionLoader.getExtensionLoader(RegistryFactory.class).getAdaptiveExtension());
Protocol dubboProtocol = DubboProtocol.getDubboProtocol();
registryProtocol.setProtocol(dubboProtocol);
URL newRegistryUrl = registryUrl.addParameter(Constants.EXPORT_KEY, serviceUrl);
DubboInvoker<DemoService> invoker = new DubboInvoker<DemoService>(DemoService.class,
newRegistryUrl, new ExchangeClient[] { new MockedClient("10.20.20.20", 2222, true) });
Exporter<DemoService> exporter = registryProtocol.export(invoker);
Exporter<DemoService> exporter2 = registryProtocol.export(invoker);
//同一个invoker,多次export的exporter不同
Assert.assertNotSame(exporter, exporter2);
exporter.unexport();
exporter2.unexport();
}
示例2: testExport
import com.alibaba.dubbo.registry.integration.RegistryProtocol; //导入方法依赖的package包/类
@Test
public void testExport() {
RegistryProtocol registryProtocol = new RegistryProtocol();
registryProtocol.setCluster(new FailfastCluster());
registryProtocol.setRegistryFactory(ExtensionLoader.getExtensionLoader(RegistryFactory.class).getAdaptiveExtension());
Protocol dubboProtocol = DubboProtocol.getDubboProtocol();
registryProtocol.setProtocol(dubboProtocol);
URL newRegistryUrl = registryUrl.addParameter(Constants.EXPORT_KEY, serviceUrl);
DubboInvoker<DemoService> invoker = new DubboInvoker<DemoService>(DemoService.class,
newRegistryUrl, new ExchangeClient[]{new MockedClient("10.20.20.20", 2222, true)});
Exporter<DemoService> exporter = registryProtocol.export(invoker);
Exporter<DemoService> exporter2 = registryProtocol.export(invoker);
//同一个invoker,多次export的exporter不同
Assert.assertNotSame(exporter, exporter2);
exporter.unexport();
exporter2.unexport();
}
示例3: testExportUrlNull
import com.alibaba.dubbo.registry.integration.RegistryProtocol; //导入方法依赖的package包/类
@Test(expected = IllegalArgumentException.class)
public void testExportUrlNull() {
RegistryProtocol registryProtocol = new RegistryProtocol();
registryProtocol.setCluster(new FailfastCluster());
Protocol dubboProtocol = DubboProtocol.getDubboProtocol();
registryProtocol.setProtocol(dubboProtocol);
Invoker<DemoService> invoker = new DubboInvoker<DemoService>(DemoService.class,
registryUrl, new ExchangeClient[] { new MockedClient("10.20.20.20", 2222, true) });
registryProtocol.export(invoker);
}
示例4: testExportUrlNull
import com.alibaba.dubbo.registry.integration.RegistryProtocol; //导入方法依赖的package包/类
@Test(expected = IllegalArgumentException.class)
public void testExportUrlNull() {
RegistryProtocol registryProtocol = new RegistryProtocol();
registryProtocol.setCluster(new FailfastCluster());
Protocol dubboProtocol = DubboProtocol.getDubboProtocol();
registryProtocol.setProtocol(dubboProtocol);
Invoker<DemoService> invoker = new DubboInvoker<DemoService>(DemoService.class,
registryUrl, new ExchangeClient[]{new MockedClient("10.20.20.20", 2222, true)});
registryProtocol.export(invoker);
}