Java Code Examples for com.alibaba.dubbo.config.ReferenceConfig#setInjvm()
The following examples show how to use
com.alibaba.dubbo.config.ReferenceConfig#setInjvm() .
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: ConfigTest.java From dubbo-2.6.5 with Apache License 2.0 | 6 votes |
@Test public void testSystemPropertyOverrideReferenceConfig() throws Exception { System.setProperty("dubbo.reference.retries", "5"); try { ServiceConfig<DemoService> service = new ServiceConfig<DemoService>(); service.setInterface(DemoService.class); service.setRef(new DemoServiceImpl()); service.setRegistry(new RegistryConfig(RegistryConfig.NO_AVAILABLE)); ProtocolConfig protocolConfig = new ProtocolConfig("injvm"); service.setProtocol(protocolConfig); service.export(); ReferenceConfig<DemoService> reference = new ReferenceConfig<DemoService>(); reference.setInterface(DemoService.class); reference.setInjvm(true); reference.setRetries(2); reference.get(); assertEquals(Integer.valueOf(5), reference.getRetries()); } finally { System.setProperty("dubbo.reference.retries", ""); } }
Example 2
Source File: ConfigTest.java From dubbox with Apache License 2.0 | 6 votes |
@Test public void testSystemPropertyOverrideReferenceConfig() throws Exception { System.setProperty("dubbo.reference.retries", "5"); try { ServiceConfig<DemoService> service = new ServiceConfig<DemoService>(); service.setInterface(DemoService.class); service.setRef(new DemoServiceImpl()); service.setRegistry(new RegistryConfig(RegistryConfig.NO_AVAILABLE)); ProtocolConfig protocolConfig = new ProtocolConfig("injvm"); service.setProtocol(protocolConfig); service.export(); ReferenceConfig<DemoService> reference = new ReferenceConfig<DemoService>(); reference.setInterface(DemoService.class); reference.setInjvm(true); reference.setRetries(2); reference.get(); assertEquals(Integer.valueOf(5), reference.getRetries()); } finally { System.setProperty("dubbo.reference.retries", ""); } }
Example 3
Source File: ConfigTest.java From dubbox-hystrix with Apache License 2.0 | 6 votes |
@Test public void testSystemPropertyOverrideReferenceConfig() throws Exception { System.setProperty("dubbo.reference.retries", "5"); try { ServiceConfig<DemoService> service = new ServiceConfig<DemoService>(); service.setInterface(DemoService.class); service.setRef(new DemoServiceImpl()); service.setRegistry(new RegistryConfig(RegistryConfig.NO_AVAILABLE)); ProtocolConfig protocolConfig = new ProtocolConfig("injvm"); service.setProtocol(protocolConfig); service.export(); ReferenceConfig<DemoService> reference = new ReferenceConfig<DemoService>(); reference.setInterface(DemoService.class); reference.setInjvm(true); reference.setRetries(2); reference.get(); assertEquals(Integer.valueOf(5), reference.getRetries()); } finally { System.setProperty("dubbo.reference.retries", ""); } }
Example 4
Source File: ConfigTest.java From dubbo3 with Apache License 2.0 | 6 votes |
@Test public void testSystemPropertyOverrideReferenceConfig() throws Exception { System.setProperty("dubbo.reference.retries", "5"); try { ServiceConfig<DemoService> service = new ServiceConfig<DemoService>(); service.setInterface(DemoService.class); service.setRef(new DemoServiceImpl()); service.setRegistry(new RegistryConfig(RegistryConfig.NO_AVAILABLE)); ProtocolConfig protocolConfig = new ProtocolConfig("injvm"); service.setProtocol(protocolConfig); service.export(); ReferenceConfig<DemoService> reference = new ReferenceConfig<DemoService>(); reference.setInterface(DemoService.class); reference.setInjvm(true); reference.setRetries(2); reference.get(); assertEquals(Integer.valueOf(5), reference.getRetries()); } finally { System.setProperty("dubbo.reference.retries", ""); } }
Example 5
Source File: ConfigTest.java From dubbox with Apache License 2.0 | 6 votes |
@Test public void testSystemPropertyOverrideReferenceConfig() throws Exception { System.setProperty("dubbo.reference.retries", "5"); try { ServiceConfig<DemoService> service = new ServiceConfig<DemoService>(); service.setInterface(DemoService.class); service.setRef(new DemoServiceImpl()); service.setRegistry(new RegistryConfig(RegistryConfig.NO_AVAILABLE)); ProtocolConfig protocolConfig = new ProtocolConfig("injvm"); service.setProtocol(protocolConfig); service.export(); ReferenceConfig<DemoService> reference = new ReferenceConfig<DemoService>(); reference.setInterface(DemoService.class); reference.setInjvm(true); reference.setRetries(2); reference.get(); assertEquals(Integer.valueOf(5), reference.getRetries()); } finally { System.setProperty("dubbo.reference.retries", ""); } }
Example 6
Source File: ConfigTest.java From dubbox with Apache License 2.0 | 6 votes |
@Test public void testSystemPropertyOverrideReferenceConfig() throws Exception { System.setProperty("dubbo.reference.retries", "5"); try { ServiceConfig<DemoService> service = new ServiceConfig<DemoService>(); service.setInterface(DemoService.class); service.setRef(new DemoServiceImpl()); service.setRegistry(new RegistryConfig(RegistryConfig.NO_AVAILABLE)); ProtocolConfig protocolConfig = new ProtocolConfig("injvm"); service.setProtocol(protocolConfig); service.export(); ReferenceConfig<DemoService> reference = new ReferenceConfig<DemoService>(); reference.setInterface(DemoService.class); reference.setInjvm(true); reference.setRetries(2); reference.get(); assertEquals(Integer.valueOf(5), reference.getRetries()); } finally { System.setProperty("dubbo.reference.retries", ""); } }
Example 7
Source File: Dubbo26ITest.java From java-specialagent with Apache License 2.0 | 5 votes |
public static ReferenceConfig<GreeterService> getClient(final String ip, final int port) { final ReferenceConfig<GreeterService> client = new ReferenceConfig<>(); client.setApplication(new ApplicationConfig("test")); client.setInterface(GreeterService.class); client.setUrl("dubbo://" + ip + ":" + port); client.setScope("local"); client.setInjvm(true); return client; }
Example 8
Source File: DubboConsumerBootstrap.java From sofa-rpc with Apache License 2.0 | 4 votes |
private void copyCommon(ConsumerConfig<T> consumerConfig, ReferenceConfig<T> referenceConfig) { referenceConfig.setInjvm(consumerConfig.isInJVM()); }