本文整理汇总了Java中com.alibaba.dubbo.registry.integration.RegistryDirectory.getMethodInvokerMap方法的典型用法代码示例。如果您正苦于以下问题:Java RegistryDirectory.getMethodInvokerMap方法的具体用法?Java RegistryDirectory.getMethodInvokerMap怎么用?Java RegistryDirectory.getMethodInvokerMap使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.alibaba.dubbo.registry.integration.RegistryDirectory
的用法示例。
在下文中一共展示了RegistryDirectory.getMethodInvokerMap方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testDestroy
import com.alibaba.dubbo.registry.integration.RegistryDirectory; //导入方法依赖的package包/类
/**
* When destroying, RegistryDirectory should: 1. be disconnected from Registry 2. destroy all invokers
*/
@Test
public void testDestroy() {
RegistryDirectory registryDirectory = getRegistryDirectory();
List<URL> serviceUrls = new ArrayList<URL>();
serviceUrls.add(SERVICEURL.addParameter("methods", "getXXX1"));
serviceUrls.add(SERVICEURL2.addParameter("methods", "getXXX1,getXXX2"));
serviceUrls.add(SERVICEURL3.addParameter("methods", "getXXX1,getXXX2,getXXX3"));
registryDirectory.notify(serviceUrls);
List<Invoker> invokers = registryDirectory.list(invocation);
Assert.assertEquals(true, registryDirectory.isAvailable());
Assert.assertEquals(true, invokers.get(0).isAvailable());
registryDirectory.destroy();
Assert.assertEquals(false, registryDirectory.isAvailable());
Assert.assertEquals(false, invokers.get(0).isAvailable());
registryDirectory.destroy();
Map<String, List<Invoker<RegistryDirectoryTest>>> methodInvokerMap = registryDirectory.getMethodInvokerMap();
Map<String, Invoker<RegistryDirectoryTest>> urlInvokerMap = registryDirectory.getUrlInvokerMap();
Assert.assertTrue(methodInvokerMap == null);
Assert.assertEquals(0, urlInvokerMap.size());
// List<U> urls = mockRegistry.getSubscribedUrls();
RpcInvocation inv = new RpcInvocation();
try {
registryDirectory.list(inv);
fail();
} catch (RpcException e) {
Assert.assertTrue(e.getMessage().contains("already destroyed"));
}
}