@Test public void testIsInjvmRefer() throws Exception { DemoService service = new DemoServiceImpl(); URL url = URL.valueOf("injvm: .addParameter(Constants.INTERFACE_KEY, DemoService.class.getName()); Exporter<?> exporter = protocol.export(proxy.getInvoker(service, DemoService.class, url)); exporters.add(exporter); url = url.setProtocol("dubbo"); assertTrue(InjvmProtocol.getInjvmProtocol().isInjvmRefer(url)); url = url.addParameter(Constants.GROUP_KEY, "*") .addParameter(Constants.VERSION_KEY, "*"); assertTrue(InjvmProtocol.getInjvmProtocol().isInjvmRefer(url)); }
public boolean isInjvmRefer(URL url) { final boolean isJvmRefer; String scope = url.getParameter(Constants.SCOPE_KEY); if (Constants.LOCAL_PROTOCOL.equals(url.getProtocol())) { isJvmRefer = false; } else if (Constants.SCOPE_LOCAL.equals(scope) || (url.getParameter("injvm", false))) { isJvmRefer = true; } else if (Constants.SCOPE_REMOTE.equals(scope)) { isJvmRefer = false; } else if (url.getParameter(Constants.GENERIC_KEY, false)) { isJvmRefer = false; } else { isJvmRefer = getExporter(exporterMap, url) != null; } return isJvmRefer; }
InjvmProtocol extends AbstractProtocol implements Protocol { public boolean isInjvmRefer(URL url) { final boolean isJvmRefer; String scope = url.getParameter(Constants.SCOPE_KEY); if (Constants.LOCAL_PROTOCOL.equals(url.getProtocol())) { isJvmRefer = false; } else if (Constants.SCOPE_LOCAL.equals(scope) || (url.getParameter("injvm", false))) { isJvmRefer = true; } else if (Constants.SCOPE_REMOTE.equals(scope)) { isJvmRefer = false; } else if (url.getParameter(Constants.GENERIC_KEY, false)) { isJvmRefer = false; } else { isJvmRefer = getExporter(exporterMap, url) != null; } return isJvmRefer; } }
InjvmProtocol extends AbstractProtocol implements Protocol { public boolean isInjvmRefer(URL url) { final boolean isJvmRefer; String scope = url.getParameter(Constants.SCOPE_KEY); if (Constants.LOCAL_PROTOCOL.equals(url.getProtocol())) { isJvmRefer = false; } else if (Constants.SCOPE_LOCAL.equals(scope) || (url.getParameter("injvm", false))) { isJvmRefer = true; } else if (Constants.SCOPE_REMOTE.equals(scope)) { isJvmRefer = false; } else if (url.getParameter(Constants.GENERIC_KEY, false)) { isJvmRefer = false; } else { isJvmRefer = getExporter(exporterMap, url) != null; } return isJvmRefer; } InjvmProtocol(); }
InjvmProtocol extends AbstractProtocol implements Protocol { public boolean isInjvmRefer(URL url) { final boolean isJvmRefer; String scope = url.getParameter(Constants.SCOPE_KEY); if (Constants.LOCAL_PROTOCOL.equals(url.getProtocol())) { isJvmRefer = false; } else if (Constants.SCOPE_LOCAL.equals(scope) || (url.getParameter("injvm", false))) { isJvmRefer = true; } else if (Constants.SCOPE_REMOTE.equals(scope)) { isJvmRefer = false; } else if (url.getParameter(Constants.GENERIC_KEY, false)) { isJvmRefer = false; } else { isJvmRefer = getExporter(exporterMap, url) != null; } return isJvmRefer; } InjvmProtocol(); int getDefaultPort(); static InjvmProtocol getInjvmProtocol(); Exporter<T> export(Invoker<T> invoker); Invoker<T> refer(Class<T> serviceType, URL url); boolean isInjvmRefer(URL url); }
InjvmProtocol extends AbstractProtocol implements Protocol { public boolean isInjvmRefer(URL url) { final boolean isJvmRefer; String scope = url.getParameter(Constants.SCOPE_KEY); if (Constants.LOCAL_PROTOCOL.equals(url.getProtocol())) { isJvmRefer = false; } else if (Constants.SCOPE_LOCAL.equals(scope) || (url.getParameter("injvm", false))) { isJvmRefer = true; } else if (Constants.SCOPE_REMOTE.equals(scope)) { isJvmRefer = false; } else if (url.getParameter(Constants.GENERIC_KEY, false)) { isJvmRefer = false; } else { isJvmRefer = getExporter(exporterMap, url) != null; } return isJvmRefer; } InjvmProtocol(); int getDefaultPort(); static InjvmProtocol getInjvmProtocol(); Exporter<T> export(Invoker<T> invoker); Invoker<T> refer(Class<T> serviceType, URL url); boolean isInjvmRefer(URL url); static final String NAME; static final int DEFAULT_PORT; }