use of com.weibo.api.motan.rpc.Exporter in project motan by weibocom.
the class DefaultRpcExporter method unexport.
@SuppressWarnings("unchecked")
@Override
public void unexport() {
String protocolKey = MotanFrameworkUtil.getProtocolKey(url);
String ipPort = url.getServerPortStr();
Exporter<T> exporter = (Exporter<T>) exporterMap.remove(protocolKey);
if (exporter != null) {
exporter.destroy();
}
ProviderMessageRouter requestRouter = ipPort2RequestRouter.get(ipPort);
if (requestRouter != null) {
requestRouter.removeProvider(provider);
}
LoggerUtil.info("DefaultRpcExporter unexport Success: url={}", url);
}
use of com.weibo.api.motan.rpc.Exporter in project motan by weibocom.
the class YarRpcProtocol method unexport.
public void unexport(URL url, Provider<?> provider) {
String protocolKey = MotanFrameworkUtil.getProtocolKey(url);
String ipPort = url.getServerPortStr();
Exporter<?> exporter = (Exporter<?>) exporterMap.remove(protocolKey);
if (exporter != null) {
exporter.destroy();
}
synchronized (ipPort2RequestRouter) {
ProviderMessageRouter requestRouter = ipPort2RequestRouter.get(ipPort);
if (requestRouter != null) {
requestRouter.removeProvider(provider);
}
}
LoggerUtil.info("yarRpcExporter unexport Success: url={}", url);
}
use of com.weibo.api.motan.rpc.Exporter in project motan by weibocom.
the class ServiceConfigBeanTest method testGetProtocolAndPort.
@Test
public void testGetProtocolAndPort() {
List<Exporter<ITest>> exporters = serviceTest.getExporters();
assertEquals(2, exporters.size());
boolean injvm = false;
boolean motan = false;
for (Exporter<ITest> exporter : exporters) {
URL url = exporter.getUrl();
if ("injvm".equals(url.getProtocol()) && url.getPort() == 0) {
injvm = true;
} else if ("motan".equals(url.getProtocol()) && url.getPort() == 7888) {
motan = true;
}
}
assertTrue(injvm && motan);
exporters = serviceTest2.getExporters();
URL url = exporters.get(0).getUrl();
assertEquals(1, exporters.size());
assertEquals("motan", url.getProtocol());
assertEquals(18080, url.getPort().intValue());
}
Aggregations