本文整理汇总了Java中com.alibaba.dubbo.config.ConsumerConfig类的典型用法代码示例。如果您正苦于以下问题:Java ConsumerConfig类的具体用法?Java ConsumerConfig怎么用?Java ConsumerConfig使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ConsumerConfig类属于com.alibaba.dubbo.config包,在下文中一共展示了ConsumerConfig类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: init
import com.alibaba.dubbo.config.ConsumerConfig; //导入依赖的package包/类
public void init() {
//对标签中名字为application的进行解析,这里dubbo使用了统一的DubboBeanDefinitionParser进行解析。
//DubboBeanDefinitionParser实现了BeanDefinitionParser接口,实现parse方法对标签进行解析。
//将解析之后的标签变成Spring中的一个Bean对象。
//application对应一个ApplicationConfig。
//在执行完init方法之后,spring会得到所有的下面这个10个handler
registerBeanDefinitionParser("application", new DubboBeanDefinitionParser(ApplicationConfig.class, true));
registerBeanDefinitionParser("module", new DubboBeanDefinitionParser(ModuleConfig.class, true));
registerBeanDefinitionParser("registry", new DubboBeanDefinitionParser(RegistryConfig.class, true));
registerBeanDefinitionParser("monitor", new DubboBeanDefinitionParser(MonitorConfig.class, true));
registerBeanDefinitionParser("provider", new DubboBeanDefinitionParser(ProviderConfig.class, true));
registerBeanDefinitionParser("consumer", new DubboBeanDefinitionParser(ConsumerConfig.class, true));
registerBeanDefinitionParser("protocol", new DubboBeanDefinitionParser(ProtocolConfig.class, true));
registerBeanDefinitionParser("service", new DubboBeanDefinitionParser(ServiceBean.class, true));
registerBeanDefinitionParser("reference", new DubboBeanDefinitionParser(ReferenceBean.class, false));
registerBeanDefinitionParser("annotation", new DubboBeanDefinitionParser(AnnotationBean.class, true));
}
示例2: testRmiTimeout
import com.alibaba.dubbo.config.ConsumerConfig; //导入依赖的package包/类
@Test
public void testRmiTimeout() throws Exception {
if (System.getProperty("sun.rmi.transport.tcp.responseTimeout") != null) {
System.setProperty("sun.rmi.transport.tcp.responseTimeout", "");
}
ConsumerConfig consumer = new ConsumerConfig();
consumer.setTimeout(1000);
assertEquals("1000", System.getProperty("sun.rmi.transport.tcp.responseTimeout"));
consumer.setTimeout(2000);
assertEquals("1000", System.getProperty("sun.rmi.transport.tcp.responseTimeout"));
}
示例3: initRefConf
import com.alibaba.dubbo.config.ConsumerConfig; //导入依赖的package包/类
private void initRefConf(){
appConfForConsumer = new ApplicationConfig();
appConfForReference = new ApplicationConfig();
regConfForConsumer = new RegistryConfig();
regConfForReference = new RegistryConfig();
methodConfForReference = new MethodConfig();
refConf = new ReferenceConfig<DemoService>();
consumerConf = new ConsumerConfig();
methodConfForReference.setName("sayName");
regConfForReference.setAddress("127.0.0.1:9090");
regConfForReference.setProtocol("mockregistry");
appConfForReference.setName("ConfigTests");
refConf.setInterface("com.alibaba.dubbo.config.api.DemoService");
refConf.setApplication(appConfForReference);
consumerConf.setApplication(appConfForConsumer);
refConf.setRegistry(regConfForReference);
consumerConf.setRegistry(regConfForConsumer);
refConf.setConsumer(consumerConf);
refConf.setMethods(Arrays.asList(new MethodConfig[]{methodConfForReference}));
refConf.setScope(Constants.SCOPE_REMOTE);
}
示例4: init
import com.alibaba.dubbo.config.ConsumerConfig; //导入依赖的package包/类
public void init() {
registerBeanDefinitionParser("application", new DubboBeanDefinitionParser(ApplicationConfig.class, true));
registerBeanDefinitionParser("module", new DubboBeanDefinitionParser(ModuleConfig.class, true));
registerBeanDefinitionParser("registry", new DubboBeanDefinitionParser(RegistryConfig.class, true));
registerBeanDefinitionParser("monitor", new DubboBeanDefinitionParser(MonitorConfig.class, true));
registerBeanDefinitionParser("provider", new DubboBeanDefinitionParser(ProviderConfig.class, true));
registerBeanDefinitionParser("consumer", new DubboBeanDefinitionParser(ConsumerConfig.class, true));
registerBeanDefinitionParser("protocol", new DubboBeanDefinitionParser(ProtocolConfig.class, true));
registerBeanDefinitionParser("service", new DubboBeanDefinitionParser(ServiceBean.class, true));
registerBeanDefinitionParser("reference", new DubboBeanDefinitionParser(ReferenceBean.class, false));
registerBeanDefinitionParser("annotation", new DubboBeanDefinitionParser(AnnotationBean.class, true));
}
示例5: init
import com.alibaba.dubbo.config.ConsumerConfig; //导入依赖的package包/类
public void init() {
registerBeanDefinitionParser("application", new DubboBeanDefinitionParser(ApplicationConfig.class, true));
registerBeanDefinitionParser("module", new DubboBeanDefinitionParser(ModuleConfig.class, true));
registerBeanDefinitionParser("registry", new DubboBeanDefinitionParser(RegistryConfig.class, true));
registerBeanDefinitionParser("monitor", new DubboBeanDefinitionParser(MonitorConfig.class, true));
registerBeanDefinitionParser("provider", new DubboBeanDefinitionParser(ProviderConfig.class, true));
registerBeanDefinitionParser("consumer", new DubboBeanDefinitionParser(ConsumerConfig.class, true));
registerBeanDefinitionParser("protocol", new DubboBeanDefinitionParser(ProtocolConfig.class, true));
registerBeanDefinitionParser("service", new DubboBeanDefinitionParser(ServiceBean.class, true));
registerBeanDefinitionParser("reference", new DubboBeanDefinitionParser(ReferenceBean.class, false));
// 注意这里是<dubbo:annotation package="com.package.to.be.scanned" />的解析
registerBeanDefinitionParser("annotation", new DubboBeanDefinitionParser(AnnotationBean.class, true));
}