Java Code Examples for com.alibaba.dubbo.rpc.Protocol#destroy()
The following examples show how to use
com.alibaba.dubbo.rpc.Protocol#destroy() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DubboShutdownHook.java From dubbo-2.6.5 with Apache License 2.0 | 6 votes |
/** * Destroy all the resources, including registries and protocols. */ public void destroyAll() { // 自旋锁,保证只处理一次,一般在项目中多线程情况下做线程开关很好用 if (!destroyed.compareAndSet(false, true)) { return; } // destroy all the registries 销毁所有注册信息=》 AbstractRegistryFactory.destroyAll(); // destroy all the protocols 销毁所有协议信息 ExtensionLoader<Protocol> loader = ExtensionLoader.getExtensionLoader(Protocol.class); for (String protocolName : loader.getLoadedExtensions()) { try { Protocol protocol = loader.getLoadedExtension(protocolName); if (protocol != null) { // 销毁协议 protocol.destroy(); } } catch (Throwable t) { logger.warn(t.getMessage(), t); } } }
Example 2
Source File: ProtocolTest.java From dubbo-2.6.5 with Apache License 2.0 | 6 votes |
@Test public void test_destroyWontCloseAllProtocol() throws Exception { Protocol autowireProtocol = ExtensionLoader.getExtensionLoader(Protocol.class).getAdaptiveExtension(); Protocol InjvmProtocol = ExtensionLoader.getExtensionLoader(Protocol.class).getExtension("injvm"); InjvmProtocol.export(invoker); Invoker<IEcho> refer = InjvmProtocol.refer(IEcho.class, url); IEcho echoProxy = proxyFactory.getProxy(refer); assertEquals("ok", echoProxy.echo("ok")); try { autowireProtocol.destroy(); } catch (UnsupportedOperationException expected) { assertThat(expected.getMessage(), containsString("of interface com.alibaba.dubbo.rpc.Protocol is not adaptive method!")); } assertEquals("ok2", echoProxy.echo("ok2")); }
Example 3
Source File: ProtocolTest.java From dubbox with Apache License 2.0 | 6 votes |
@Test public void test_destroyWontCloseAllProtocol() throws Exception { Protocol autowireProtocol = ExtensionLoader.getExtensionLoader(Protocol.class).getAdaptiveExtension(); Protocol InjvmProtocol = ExtensionLoader.getExtensionLoader(Protocol.class).getExtension("injvm"); InjvmProtocol.export(invoker); Invoker<IEcho> refer = InjvmProtocol.refer(IEcho.class, url); IEcho echoProxy = proxyFactory.getProxy(refer); assertEquals("ok", echoProxy.echo("ok")); try { autowireProtocol.destroy(); } catch (UnsupportedOperationException expected) { assertThat(expected.getMessage(), containsString("of interface com.alibaba.dubbo.rpc.Protocol is not adaptive method!")); } assertEquals("ok2", echoProxy.echo("ok2")); }
Example 4
Source File: ProtocolTest.java From dubbox-hystrix with Apache License 2.0 | 6 votes |
@Test public void test_destroyWontCloseAllProtocol() throws Exception { Protocol autowireProtocol = ExtensionLoader.getExtensionLoader(Protocol.class).getAdaptiveExtension(); Protocol InjvmProtocol = ExtensionLoader.getExtensionLoader(Protocol.class).getExtension("injvm"); InjvmProtocol.export(invoker); Invoker<IEcho> refer = InjvmProtocol.refer(IEcho.class, url); IEcho echoProxy = proxyFactory.getProxy(refer); assertEquals("ok", echoProxy.echo("ok")); try { autowireProtocol.destroy(); } catch (UnsupportedOperationException expected) { assertThat(expected.getMessage(), containsString("of interface com.alibaba.dubbo.rpc.Protocol is not adaptive method!")); } assertEquals("ok2", echoProxy.echo("ok2")); }
Example 5
Source File: ProtocolTest.java From dubbox with Apache License 2.0 | 6 votes |
@Test public void test_destroyWontCloseAllProtocol() throws Exception { Protocol autowireProtocol = ExtensionLoader.getExtensionLoader(Protocol.class).getAdaptiveExtension(); Protocol InjvmProtocol = ExtensionLoader.getExtensionLoader(Protocol.class).getExtension("injvm"); InjvmProtocol.export(invoker); Invoker<IEcho> refer = InjvmProtocol.refer(IEcho.class, url); IEcho echoProxy = proxyFactory.getProxy(refer); assertEquals("ok", echoProxy.echo("ok")); try { autowireProtocol.destroy(); } catch (UnsupportedOperationException expected) { assertThat(expected.getMessage(), containsString("of interface com.alibaba.dubbo.rpc.Protocol is not adaptive method!")); } assertEquals("ok2", echoProxy.echo("ok2")); }
Example 6
Source File: ProtocolTest.java From dubbo3 with Apache License 2.0 | 6 votes |
@Test public void test_destroyWontCloseAllProtocol() throws Exception { Protocol autowireProtocol = ExtensionLoader.getExtensionLoader(Protocol.class).getAdaptiveExtension(); Protocol InjvmProtocol = ExtensionLoader.getExtensionLoader(Protocol.class).getExtension("injvm"); InjvmProtocol.export(invoker); Invoker<IEcho> refer = InjvmProtocol.refer(IEcho.class, url); IEcho echoProxy = proxyFactory.getProxy(refer); assertEquals("ok", echoProxy.echo("ok")); try { autowireProtocol.destroy(); } catch (UnsupportedOperationException expected) { assertThat(expected.getMessage(), containsString("of interface com.alibaba.dubbo.rpc.Protocol is not adaptive method!")); } assertEquals("ok2", echoProxy.echo("ok2")); }
Example 7
Source File: ProtocolTest.java From dubbox with Apache License 2.0 | 6 votes |
@Test public void test_destroyWontCloseAllProtocol() throws Exception { Protocol autowireProtocol = ExtensionLoader.getExtensionLoader(Protocol.class).getAdaptiveExtension(); Protocol InjvmProtocol = ExtensionLoader.getExtensionLoader(Protocol.class).getExtension("injvm"); InjvmProtocol.export(invoker); Invoker<IEcho> refer = InjvmProtocol.refer(IEcho.class, url); IEcho echoProxy = proxyFactory.getProxy(refer); assertEquals("ok", echoProxy.echo("ok")); try { autowireProtocol.destroy(); } catch (UnsupportedOperationException expected) { assertThat(expected.getMessage(), containsString("of interface com.alibaba.dubbo.rpc.Protocol is not adaptive method!")); } assertEquals("ok2", echoProxy.echo("ok2")); }
Example 8
Source File: ProtocolConfig.java From dubbox with Apache License 2.0 | 5 votes |
public static void destroyAll() { AbstractRegistryFactory.destroyAll(); ExtensionLoader<Protocol> loader = ExtensionLoader.getExtensionLoader(Protocol.class); for (String protocolName : loader.getLoadedExtensions()) { try { Protocol protocol = loader.getLoadedExtension(protocolName); if (protocol != null) { protocol.destroy(); } } catch (Throwable t) { logger.warn(t.getMessage(), t); } } }
Example 9
Source File: ProtocolConfig.java From dubbox with Apache License 2.0 | 5 votes |
public static void destroyAll() { AbstractRegistryFactory.destroyAll(); ExtensionLoader<Protocol> loader = ExtensionLoader.getExtensionLoader(Protocol.class); for (String protocolName : loader.getLoadedExtensions()) { try { Protocol protocol = loader.getLoadedExtension(protocolName); if (protocol != null) { protocol.destroy(); } } catch (Throwable t) { logger.warn(t.getMessage(), t); } } }
Example 10
Source File: ProtocolConfig.java From dubbox-hystrix with Apache License 2.0 | 5 votes |
public static void destroyAll() { AbstractRegistryFactory.destroyAll(); ExtensionLoader<Protocol> loader = ExtensionLoader.getExtensionLoader(Protocol.class); for (String protocolName : loader.getLoadedExtensions()) { try { Protocol protocol = loader.getLoadedExtension(protocolName); if (protocol != null) { protocol.destroy(); } } catch (Throwable t) { logger.warn(t.getMessage(), t); } } }
Example 11
Source File: ProtocolConfig.java From dubbo3 with Apache License 2.0 | 5 votes |
public static void destroyAll() { AbstractRegistryFactory.destroyAll(); ExtensionLoader<Protocol> loader = ExtensionLoader.getExtensionLoader(Protocol.class); for (String protocolName : loader.getLoadedExtensions()) { try { Protocol protocol = loader.getLoadedExtension(protocolName); if (protocol != null) { protocol.destroy(); } } catch (Throwable t) { logger.warn(t.getMessage(), t); } } }
Example 12
Source File: ProtocolConfig.java From dubbox with Apache License 2.0 | 5 votes |
public static void destroyAll() { AbstractRegistryFactory.destroyAll(); ExtensionLoader<Protocol> loader = ExtensionLoader.getExtensionLoader(Protocol.class); for (String protocolName : loader.getLoadedExtensions()) { try { Protocol protocol = loader.getLoadedExtension(protocolName); if (protocol != null) { protocol.destroy(); } } catch (Throwable t) { logger.warn(t.getMessage(), t); } } }
Example 13
Source File: RegistryProtocolTest.java From dubbox with Apache License 2.0 | 4 votes |
private void destroyRegistryProtocol(){ Protocol registry = RegistryProtocol.getRegistryProtocol(); registry.destroy(); }
Example 14
Source File: RegistryProtocolTest.java From dubbox with Apache License 2.0 | 4 votes |
private void destroyRegistryProtocol(){ Protocol registry = RegistryProtocol.getRegistryProtocol(); registry.destroy(); }
Example 15
Source File: RegistryProtocolTest.java From dubbox-hystrix with Apache License 2.0 | 4 votes |
private void destroyRegistryProtocol(){ Protocol registry = RegistryProtocol.getRegistryProtocol(); registry.destroy(); }
Example 16
Source File: RegistryProtocolTest.java From dubbox with Apache License 2.0 | 4 votes |
private void destroyRegistryProtocol(){ Protocol registry = RegistryProtocol.getRegistryProtocol(); registry.destroy(); }
Example 17
Source File: RegistryProtocolTest.java From dubbo-2.6.5 with Apache License 2.0 | 4 votes |
private void destroyRegistryProtocol() { Protocol registry = RegistryProtocol.getRegistryProtocol(); registry.destroy(); }