LE'ESS注册过商标注册证吗?还有哪些分类可以注册?

通用解决方案
行业解决方案
企业服务解决方案
安全解决方案
大数据解决方案
DevOps解决方案
ET行业大脑
人工智能解决方案
机器算法平台
ET大脑生态
数据分析与展现
大数据应用
大数据基础服务
天池AI生态
安全解决方案
安全服务 · 先知
建议与反馈
技术与赋能
售前咨询 95187转1
[{"name":"noesc"},{"name":"haveecs"},{"name":"haverds"},{"name":"moren"},{"name":"memberpoints"}]
[{"customer_type":[{"0":"false","1":"false","tce_rule_count":"1"}],"go_to_aboad_demand_level":[{"0":"false","1":"false","2":"false","tce_rule_count":"1"}],"isGcLevel12":"false","isGcLevel3":"false","lost_risk_score":[{"0":"false","1":"false","2":"false","tce_rule_count":"1"}],"user_tech_strength":[{"0":"false","1":"false","2":"false","tce_rule_count":"1"}],"association":"not_effective","aliyun_site_activity_level":[{"0":"false","1":"false","2":"false","tce_rule_count":"1"}],"main_browse_prd":[{"rds":"false","ecs":"false","mail":"false","vm":"false","domain":"false","tce_rule_count":"1","slb":"false","cdn":"false","oss":"false"}],"longTailUser":"false","result":"noesc","user_dentity_des":[{"技术/运维":"false","技术部副负责人":"false","其它":"false","高级架构师":"false","tce_rule_count":"1","平台工程师":"false","站长":"false","CEO":"false","CEO (法人)":"false","项目负责人":"false","技术负责人":"false","财务负责人":"false","股东":"false","技术运维负责人":"false","运维负责人":"false","技术人员":"false"}],"new_user_ecs_buy_level":[{"0":"false","1":"false","2":"false","tce_rule_count":"1"}],"aliyun_prd_retain":[{"rds":"false","ecs":"false","mail":"false","vm":"false","domain":"false","tce_rule_count":"1","slb":"false","cdn":"false","oss":"false"}],"prob_cal_level_churn":[{"0":"false","1":"false","2":"false","tce_rule_count":"1"}],"user_level_yun":[{"tce_rule_count":"1","V0":"false","V1":"false","V2":"false","V3":"false","V4":"false"},{"tce_rule_count":"1","V0":"false","V1":"false","V2":"false","V3":"false","V4":"false"}],"user_level":[{"L0":"false","L1":"false","L2":"false","L3":"false","tce_rule_count":"1","L4":"false"},{"L0":"false","L1":"false","L2":"false","L3":"false","tce_rule_count":"1","L4":"false"},{"L0":"false","L1":"false","L2":"false","L3":"false","tce_rule_count":"1","L4":"false"}],"user_cat_level1":[{"0":"false","1":"false","2":"false","tce_rule_count":"1"}],"is_ecs_retain":"0","user_cat_name_level1":[{"网站":"false","其它":"false","通讯社交":"false","tce_rule_count":"1","o2o":"false","金融":"false","IT与软件开发":"false","能源/交通运输/生产制造":"false","移动APP":"false","教育":"false","音视频":"false","医疗健康":"false","政府/事业单位":"false","游戏":"false","物联网":"false","电子商务":"false","旅游":"false"}],"interested_prd":[{"rds":"false","ecs":"false","mail":"false","vm":"false","domain":"false","tce_rule_count":"1","slb":"false","cdn":"false","oss":"false"}],"ecs_res_use_stage":[{"0":"false","1":"false","2":"false","tce_rule_count":"1"}]},{"customer_type":[{"0":"false","1":"false","tce_rule_count":"1"}],"go_to_aboad_demand_level":[{"0":"false","1":"false","2":"false","tce_rule_count":"1"}],"isGcLevel12":"false","isGcLevel3":"false","is_rds_retain":"1","lost_risk_score":[{"0":"false","1":"false","2":"false","tce_rule_count":"1"}],"user_tech_strength":[{"0":"false","1":"false","2":"false","tce_rule_count":"1"}],"association":"not_effective","aliyun_site_activity_level":[{"0":"false","1":"false","2":"false","tce_rule_count":"1"}],"main_browse_prd":[{"rds":"false","ecs":"false","mail":"false","vm":"false","domain":"false","tce_rule_count":"1","slb":"false","cdn":"false","oss":"false"}],"longTailUser":"false","result":"haverds","user_dentity_des":[{"技术/运维":"false","技术部副负责人":"false","其它":"false","高级架构师":"false","tce_rule_count":"1","平台工程师":"false","站长":"false","CEO":"false","CEO (法人)":"false","项目负责人":"false","技术负责人":"false","财务负责人":"false","股东":"false","技术运维负责人":"false","运维负责人":"false","技术人员":"false"}],"new_user_ecs_buy_level":[{"0":"false","1":"false","2":"false","tce_rule_count":"1"}],"aliyun_prd_retain":[{"rds":"false","ecs":"false","mail":"false","vm":"false","domain":"false","tce_rule_count":"1","slb":"false","cdn":"false","oss":"false"}],"prob_cal_level_churn":[{"0":"false","1":"false","2":"false","tce_rule_count":"1"}],"user_level_yun":[{"tce_rule_count":"1","V0":"false","V1":"false","V2":"false","V3":"false","V4":"false"}],"user_level":[{"L0":"false","L1":"false","L2":"false","L3":"false","tce_rule_count":"1","L4":"false"},{"L0":"false","L1":"false","L2":"false","L3":"false","tce_rule_count":"1","L4":"false"}],"user_cat_level1":[{"0":"false","1":"false","2":"false","tce_rule_count":"1"}],"user_cat_name_level1":[{"网站":"false","其它":"false","通讯社交":"false","tce_rule_count":"1","o2o":"false","金融":"false","IT与软件开发":"false","能源/交通运输/生产制造":"false","移动APP":"false","教育":"false","音视频":"false","医疗健康":"false","政府/事业单位":"false","游戏":"false","物联网":"false","电子商务":"false","旅游":"false"}],"interested_prd":[{"rds":"false","ecs":"false","mail":"false","vm":"false","domain":"false","tce_rule_count":"1","slb":"false","cdn":"false","oss":"false"}],"ecs_res_use_stage":[{"0":"false","1":"false","2":"false","tce_rule_count":"1"}]},{"result":"haveecs","isGcLevel12":"false","isGcLevel3":"false","association":"not_effective","is_ecs_retain":"1","longTailUser":"false"},{"result":"moren","isGcLevel12":"false","isGcLevel3":"false","association":"not_effective","reg_days":"999999","longTailUser":"false"},{"result":"memberpoints","isGcLevel12":"false","isGcLevel3":"false","association":"not_effective","longTailUser":"false"},{"result":"caigouji","isGcLevel12":"false","isGcLevel3":"false","association":"not_effective","user_level":[],"user_cat_level1":[{"0":"true","1":"true","2":"true","tce_rule_count":"1"}],"longTailUser":"false"},{"result":"inactiverecall","isGcLevel12":"false","isGcLevel3":"false","association":"not_effective","member_rights":"FY_riskandlost_Maraccess","longTailUser":"false"}]
[{"name":"haveecs"},{"name":"haverds"},{"name":"websiteit"},{"name":"personal"}]
[{"customer_type":[{"0":"false","1":"false","tce_rule_count":"1"}],"go_to_aboad_demand_level":[{"0":"false","1":"false","2":"false","tce_rule_count":"1"}],"lost_risk_score":[{"0":"false","1":"false","2":"false","tce_rule_count":"1"}],"user_tech_strength":[{"0":"false","1":"false","2":"false","tce_rule_count":"1"}],"association":"not_effective","aliyun_site_activity_level":[{"0":"false","1":"false","2":"false","tce_rule_count":"1"}],"main_browse_prd":[{"rds":"false","ecs":"false","mail":"false","vm":"false","domain":"false","tce_rule_count":"1","slb":"false","cdn":"false","oss":"false"}],"longTailUser":"false","result":"websiteit","user_dentity_des":[{"技术/运维":"false","技术部副负责人":"false","其它":"false","高级架构师":"false","tce_rule_count":"1","平台工程师":"false","站长":"false","CEO":"false","CEO (法人)":"false","项目负责人":"false","技术负责人":"false","财务负责人":"false","股东":"false","技术运维负责人":"false","运维负责人":"false","技术人员":"false"}],"new_user_ecs_buy_level":[{"0":"false","1":"false","2":"false","tce_rule_count":"1"}],"aliyun_prd_retain":[{"rds":"false","ecs":"false","mail":"false","vm":"false","domain":"false","tce_rule_count":"1","slb":"false","cdn":"false","oss":"false"}],"prob_cal_level_churn":[{"0":"false","1":"false","2":"false","tce_rule_count":"1"}],"user_level_yun":[{"tce_rule_count":"1","V0":"false","V1":"false","V2":"false","V3":"false","V4":"false"},{"tce_rule_count":"1","V0":"false","V1":"false","V2":"false","V3":"false","V4":"false"}],"user_level":[],"user_cat_level1":[{"0":"true","1":"false","2":"false","tce_rule_count":"1"}],"user_cat_name_level1":[{"网站":"true","其它":"false","通讯社交":"false","tce_rule_count":"1","o2o":"false","金融":"false","IT与软件开发":"true","能源/交通运输/生产制造":"false","移动APP":"true","教育":"false","音视频":"false","医疗健康":"false","政府/事业单位":"false","游戏":"false","物联网":"false","电子商务":"false","旅游":"false"}],"interested_prd":[{"rds":"false","ecs":"false","mail":"false","vm":"false","domain":"false","tce_rule_count":"1","slb":"false","cdn":"false","oss":"false"}],"ecs_res_use_stage":[{"0":"false","1":"false","2":"false","tce_rule_count":"1"}]},{"result":"haveecs","customer_type":[{"0":"false","1":"false","tce_rule_count":"1"}],"association":"not_effective","is_ecs_retain":"1","longTailUser":"false"},{"result":"haverds","is_rds_retain":"1","association":"not_effective","longTailUser":"false"},{"result":"personal","customer_type":[{"0":"true","1":"false","tce_rule_count":"1"}],"association":"not_effective","longTailUser":"false"}]
中国企业和个人的互联网标识!
/元首年 &&&&&&&查看多年价格
英文字母(a-z)、数字(0-9)、以及"-"(即中横线,不能用作开头和结尾),不能使用空格及特殊字符(如!、$、&、? 等),总长度不能超过63字符。
关于.cn域名
.cn域名是由我国管理的国际顶级域名,是中国自己的互联网标识,cn一般代表中国,它体现了一种文化的认同、自身的价值和定位。当前cn域名在全球具有最大的市场,适合任何企业、组织、个人注册。
根据注册局规定,.cn英文域名注册成功后必须在5天内提交资料并通过审核后才能正常使用,否则域名将被注册局锁定。
注册成功但未提交资料或未通过资料审核的国内域名(.cn、.中国等)处于冻结状态,暂无法使用(即无法指向目标网站或邮箱)。建议您注册域名并完成支付后尽快提交实名认证资料扫描件至万网进行审核,万网审核通过后注册局将进行复审,48小时内(节假日除外)返回审核结果,注册局审核通过后域名即可使用。 如果您是以公司、企业等组织机构身份申请的域名,需提交: 与域名持有公司企业一致的组织机构代码证扫描件或营业执照扫描件如果您是以个人身份申请的域名,需提交: 和域名持有者一致的身份证正面扫描件如果您没有身份证,可以提交以下身份证明材料其中之一代替:户口簿原件扫描件盖有公安局户口专用章的户籍证明扫描件临时身份证扫描件
全球最具影响力的域名
选择注册.cn域名的企业越来越多,已经超越.com,成为全球最具影响力的的通用域名。
中国企业和个人自己的互联网标识
.cn域名是中国企业或个人自己的互联网标识,它体现了一种文化的认同。
最适合中国人注册的域名
适用中国法律,全面保障用户利益;全中文服务,保障用户知情权;注册手续简便、快捷。_商标性使用_的法律效力_何怀文_图文_百度文库
您的浏览器Javascript被禁用,需开启后体验完整功能,
享专业文档下载特权
&赠共享文档下载特权
&10W篇文档免费专享
&每天抽奖多种福利
两大类热门资源免费畅读
续费一年阅读会员,立省24元!
_商标性使用_的法律效力_何怀文
阅读已结束,下载本文需要
想免费下载本文?
定制HR最喜欢的简历
下载文档到电脑,同时保存到云知识,更方便管理
加入VIP
还剩9页未读,
定制HR最喜欢的简历
你可能喜欢百度知道 - 全球最大中文互动问答平台dubbo服务注册与发现、服务调用过程 - 简书
dubbo服务注册与发现、服务调用过程
这篇文章主要以源码分析dubbo服务注册、服务暴露、服务发现、服务调用过程。
dubbo 自定义标签解析
加载dubbo.xml配置文件是加载xml schema时会自动加载对应META-INF/spring.handlers下的配置,原理就是spring提供解析扩展标签机制。
META-INF/spring.handlers
http\://code.alibabatech.com/schema/dubbo=com.alibaba.dubbo.config.spring.schema.DubboNamespaceHandler
META-INF/spring.schemas
http\://code.alibabatech.com/schema/dubbo/dubbo.xsd=META-INF/dubbo.xsd
DubboNamespaceHandler.java
spring解析扩展标签,需要实现一个NamespaceHandler的实现类,这个类指明标签组各个子标签的解析器。
public class DubboNamespaceHandler extends NamespaceHandlerSupport {
Version.checkDuplicate(DubboNamespaceHandler.class);
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));
DubboBeanDefinitionParser.java
子标签的解析器,完成对各个标签的解析,标签的实例化
if (ServiceBean.class.equals(beanClass)) {
String className = element.getAttribute("class");
if (className != null && className.length() & 0) {
RootBeanDefinition classDefinition = new RootBeanDefinition();
classDefinition.setBeanClass(ReflectUtils.forName(className));
classDefinition.setLazyInit(false);
parseProperties(element.getChildNodes(), classDefinition);
beanDefinition.getPropertyValues().addPropertyValue("ref", new BeanDefinitionHolder(classDefinition, id + "Impl"));
dubbo服务注册和暴露
在上面标签解析的基础上,每个service方法的配置会解析成对应的 com.alibaba.dubbo.config.spring.ServiceBean&T& 类的实例。
ServiceBean 实现InitializingBean,DisposableBean,实现对象初始化和销毁方法。对象实例化后对服务进行注册到注册中心、暴露服务。服务注册和暴露在方法afterPropertiesSet执行,这个方法代码比较多,不重要的地方省略。组装好服务URL各种信息,最终委托对应协议暴露服务,这边以dubbo协议为例子。
public void afterPropertiesSet() throws Exception {
//省略组装providerConfig
setProvider(providerConfig);
//省略组装applicationConfig
setApplication(applicationConfig);
//省略组装moduleConfig
setModule(moduleConfig);
//省略组装registryConfigs
super.setRegistries(registryConfigs);
//省略组装monitorConfig
setMonitor(monitorConfig);
//省略组装protocolConfigs
super.setProtocols(protocolConfigs);
setPath(beanName);
if (!isDelay()) {
在afterPropertiesSet之后,会调用到ServiceConfig.export()方法
public synchronized void export() {
if (provider != null) {
if (export == null) {
export = provider.getExport();
if (delay == null) {
delay = provider.getDelay();
if (export != null && !export) {
if (delay != null && delay & 0) {
delayExportExecutor.schedule(new Runnable() {
public void run() {
doExport();
}, delay, TimeUnit.MILLISECONDS);
doExport();
ServiceConfig.export() -& ServiceConfig.doExport() -& ServiceConfig.doExportUrls() -& ServiceConfig.doExportUrlsFor1Protocol()
private void doExportUrlsFor1Protocol(ProtocolConfig protocolConfig, List&URL& registryURLs) {
String name = protocolConfig.getName();
if (name == null || name.length() == 0) {
name = "dubbo";
//map中保存的是url对应的各种参数
Map&String, String& map = new HashMap&String, String&();
map.put(Constants.SIDE_KEY, Constants.PROVIDER_SIDE);
map.put(Constants.DUBBO_VERSION_KEY, Version.getVersion());
map.put(Constants.TIMESTAMP_KEY, String.valueOf(System.currentTimeMillis()));
if (ConfigUtils.getPid() & 0) {
map.put(Constants.PID_KEY, String.valueOf(ConfigUtils.getPid()));
appendParameters(map, application);
appendParameters(map, module);
appendParameters(map, provider, Constants.DEFAULT_KEY);
appendParameters(map, protocolConfig);
appendParameters(map, this);
//中间代码有省略
if (ProtocolUtils.isGeneric(generic)) {
map.put("generic", generic);
map.put("methods", Constants.ANY_VALUE);
String revision = Version.getVersion(interfaceClass, version);
if (revision != null && revision.length() & 0) {
map.put("revision", revision);
String[] methods = Wrapper.getWrapper(interfaceClass).getMethodNames();
if (methods.length == 0) {
logger.warn("NO method found in service interface " + interfaceClass.getName());
map.put("methods", Constants.ANY_VALUE);
map.put("methods", StringUtils.join(new HashSet&String&(Arrays.asList(methods)), ","));
if (!ConfigUtils.isEmpty(token)) {
if (ConfigUtils.isDefault(token)) {
map.put("token", UUID.randomUUID().toString());
map.put("token", token);
if ("injvm".equals(protocolConfig.getName())) {
protocolConfig.setRegister(false);
map.put("notify", "false");
// 暴露服务
String contextPath = protocolConfig.getContextpath();
if ((contextPath == null || contextPath.length() == 0) && provider != null) {
contextPath = provider.getContextpath();
String host = this.findConfigedHosts(protocolConfig, registryURLs, map);
Integer port = this.findConfigedPorts(protocolConfig, name, map);
URL url = new URL(name, host, port, (contextPath == null || contextPath.length() == 0 ? "" : contextPath + "/") + path, map);
if (ExtensionLoader.getExtensionLoader(ConfiguratorFactory.class)
.hasExtension(url.getProtocol())) {
url = ExtensionLoader.getExtensionLoader(ConfiguratorFactory.class)
.getExtension(url.getProtocol()).getConfigurator(url).configure(url);
String scope = url.getParameter(Constants.SCOPE_KEY);
// don't export when none is configured
if (!Constants.SCOPE_NONE.toString().equalsIgnoreCase(scope)) {
// export to local if the config is not remote (export to remote only when config is remote)
if (!Constants.SCOPE_REMOTE.toString().equalsIgnoreCase(scope)) {
exportLocal(url);
// export to remote if the config is not local (export to local only when config is local)
if (!Constants.SCOPE_LOCAL.toString().equalsIgnoreCase(scope)) {
if (logger.isInfoEnabled()) {
logger.info("Export dubbo service " + interfaceClass.getName() + " to url " + url);
if (registryURLs != null && registryURLs.size() & 0) {
for (URL registryURL : registryURLs) {
url = url.addParameterIfAbsent("dynamic", registryURL.getParameter("dynamic"));
URL monitorUrl = loadMonitor(registryURL);
if (monitorUrl != null) {
url = url.addParameterAndEncoded(Constants.MONITOR_KEY, monitorUrl.toFullString());
if (logger.isInfoEnabled()) {
logger.info("Register dubbo service " + interfaceClass.getName() + " url " + url + " to registry " + registryURL);
Invoker&?& invoker = proxyFactory.getInvoker(ref, (Class) interfaceClass, registryURL.addParameterAndEncoded(Constants.EXPORT_KEY, url.toFullString()));
DelegateProviderMetaDataInvoker wrapperInvoker = new DelegateProviderMetaDataInvoker(invoker, this);
// 这里invoker对象协议是registry,protocol根据协议找到RegisterProtocol实现类。
// 在调用RegisterProtocol类的export方法之前会先调用ProtocolListenerWrapper类的export方法
// protocol实例转化为ProtocolFilterWrapper,包了一层RegistryProtocol
Exporter&?& exporter = protocol.export(wrapperInvoker);
exporters.add(exporter);
Invoker&?& invoker = proxyFactory.getInvoker(ref, (Class) interfaceClass, url);
DelegateProviderMetaDataInvoker wrapperInvoker = new DelegateProviderMetaDataInvoker(invoker, this);
Exporter&?& exporter = protocol.export(wrapperInvoker);
exporters.add(exporter);
this.urls.add(url);
ps:protocol如何知道哪个实现类?根据url的协议来创建对应的Protocol。
在ServiceConfig初始化的时候,protocol初始化为
protocol=ExtensionLoader.getExtensionLoader(Protocol.class).getAdaptiveExtension(); getAdaptiveExtension这个方法说明在调用的时候再决定使用什么扩展。
最终的注册还是在RegistryProtocol.export完成。
public &T& Exporter&T& export(final Invoker&T& originInvoker) throws RpcException {
//export invoker
// 在本地暴露的时候会开启Netty服务
final ExporterChangeableWrapper&T& exporter = doLocalExport(originInvoker);
在本地暴露服务时,protocol会转化成DubboProtocol
private &T& ExporterChangeableWrapper&T&
doLocalExport(final Invoker&T& originInvoker){
String key = getCacheKey(originInvoker);
ExporterChangeableWrapper&T& exporter = (ExporterChangeableWrapper&T&) bounds.get(key);
if (exporter == null) {
synchronized (bounds) {
exporter = (ExporterChangeableWrapper&T&) bounds.get(key);
if (exporter == null) {
final Invoker&?& invokerDelegete = new InvokerDelegete&T&(originInvoker,
getProviderUrl(originInvoker));
exporter = new ExporterChangeableWrapper&T&((Exporter&T&)
protocol.export(invokerDelegete), originInvoker);
bounds.put(key, exporter);
return (ExporterChangeableWrapper&T&)
最终会走到DubboProtocol.export方法通过netty开启服务
public &T& Exporter&T& export(Invoker&T& invoker) throws RpcException {
URL url = invoker.getUrl();
// export service.
String key = serviceKey(url);
DubboExporter&T& exporter = new DubboExporter&T&(invoker, key, exporterMap);
exporterMap.put(key, exporter);
// 这里会判断是否是stub服务(不是太懂,默认是false的)
//export an stub service for dispaching event
Boolean isStubSupportEvent = url.getParameter(Constants.STUB_EVENT_KEY,Constants.DEFAULT_STUB_EVENT);
// 判断是否是callback服务
Boolean isCallbackservice = url.getParameter(Constants.IS_CALLBACK_SERVICE, false);
if (isStubSupportEvent && !isCallbackservice){
String stubServiceMethods = url.getParameter(Constants.STUB_EVENT_METHODS_KEY);
if (stubServiceMethods == null || stubServiceMethods.length() == 0 ){
stubServiceMethodsMap.put(url.getServiceKey(), stubServiceMethods);
// 开启Netty服务
openServer(url);
openServer方法会根据key(ip+port)判断server是否存在,不存在则调用createServer(URL url)方法创建一个NettyServer来开启服务,
protected void doOpen() throws Throwable {
NettyHelper.setNettyLoggerFactory();
bootstrap = new ServerBootstrap();
bossGroup = new NioEventLoopGroup(1, new DefaultThreadFactory("NettyServerBoss", true));
workerGroup = new NioEventLoopGroup(getUrl().getPositiveParameter(Constants.IO_THREADS_KEY, Constants.DEFAULT_IO_THREADS),
new DefaultThreadFactory("NettyServerWorker", true));
final NettyServerHandler nettyServerHandler = new NettyServerHandler(getUrl(), this);
channels = nettyServerHandler.getChannels();
bootstrap.group(bossGroup, workerGroup)
.channel(NioServerSocketChannel.class)
.childOption(ChannelOption.TCP_NODELAY, Boolean.TRUE)
.childOption(ChannelOption.SO_REUSEADDR, Boolean.TRUE)
.childOption(ChannelOption.ALLOCATOR, PooledByteBufAllocator.DEFAULT)
.childHandler(new ChannelInitializer&NioSocketChannel&() {
protected void initChannel(NioSocketChannel ch) throws Exception {
NettyCodecAdapter adapter = new NettyCodecAdapter(getCodec(), getUrl(), NettyServer.this);
ch.pipeline()//.addLast("logging",new LoggingHandler(LogLevel.INFO))//for debug
.addLast("decoder", adapter.getDecoder())
.addLast("encoder", adapter.getEncoder())
.addLast("handler", nettyServerHandler);
ChannelFuture channelFuture = bootstrap.bind(getBindAddress());
channelFuture.syncUninterruptibly();
channel = channelFuture.channel();
回到RegistryProtocol中,看如何在zk中注册服务。
public &T& Exporter&T& export(final Invoker&T& originInvoker) throws RpcException {
//export invoker
// 在本地暴露服务
final ExporterChangeableWrapper&T& exporter = doLocalExport(originInvoker);
//registry provider
// 拿到zookeeper的注册信息
final Registry registry = getRegistry(originInvoker);
// 获取需要暴露provider的url对象,dubbo的注册订阅通信都是以url作为参数传递的
final URL registedProviderUrl = getRegistedProviderUrl(originInvoker);
registry.register(registedProviderUrl); // 注册服务
// 订阅override数据
// FIXME 提供者订阅时,会影响同一JVM即暴露服务,又引用同一服务的的场景,
// 因为subscribed以服务名为缓存的key,导致订阅信息覆盖。
final URL overrideSubscribeUrl = getSubscribedOverrideUrl(registedProviderUrl);
final OverrideListener overrideSubscribeListener = new OverrideListener(overrideSubscribeUrl);
overrideListeners.put(overrideSubscribeUrl, overrideSubscribeListener);
// 暴露的同时订阅服务,另外会在zk上创建configurators节点信息
registry.subscribe(overrideSubscribeUrl, overrideSubscribeListener);
//保证每次export都返回一个新的exporter实例
return new Exporter&T&() {
最终会调用ZookeeperRegistry.doRegister注册服务
protected void doRegister(URL url) {
zkClient.create(toUrlPath(url), url.getParameter(Constants.DYNAMIC_KEY, true));
} catch (Throwable e) {
throw new RpcException("Failed to register " + url + " to zookeeper " + getUrl() + ", cause: " + e.getMessage(), e);
在/dubbo/service_path/providers 会注册哪些信息?看下面的一个例子
/dubbo/com.****.management.api.service/providers
消费者如何注册服务和发现服务
解析&dubbo:eference/&时会实例会ReferenceBean对象,实例对象后同样会调用afterPropertiesSet方法。最终会调用RegistryProtocol的dorefer()方法进行服务注册
private &T& Invoker&T& doRefer(Cluster cluster, Registry registry, Class&T& type, URL url) {
RegistryDirectory&T& directory = new RegistryDirectory&T&(type, url);
directory.setRegistry(registry);
directory.setProtocol(protocol);
URL subscribeUrl = new URL(Constants.CONSUMER_PROTOCOL, NetUtils.getLocalHost(), 0, type.getName(), directory.getUrl().getParameters());
if (! Constants.ANY_VALUE.equals(url.getServiceInterface())
&& url.getParameter(Constants.REGISTER_KEY, true)) {
registry.register(subscribeUrl.addParameters(Constants.CATEGORY_KEY, Constants.CONSUMERS_CATEGORY,
Constants.CHECK_KEY, String.valueOf(false)));
directory.subscribe(subscribeUrl.addParameter(Constants.CATEGORY_KEY,
Constants.PROVIDERS_CATEGORY
+ "," + Constants.CONFIGURATORS_CATEGORY
+ "," + Constants.ROUTERS_CATEGORY));
return cluster.join(directory);
最终会调用ZookeeperRegistry.doRegister注册服务,代码省略。这就完成消费者服务注册。注册之后注册目录(RegistryDirectory)订阅subscribeUrl的通知,此过程中会把invoker封装为invokerDelegate并在RegistryDirectory中缓存urlInvokerMap。这就完成了服务的发现。
private void refreshInvoker(List&URL& invokerUrls) {
if (invokerUrls != null && invokerUrls.size() == 1 && invokerUrls.get(0) != null
&& Constants.EMPTY_PROTOCOL.equals(invokerUrls.get(0).getProtocol())) {
this.forbidden = // Forbid to access
this.methodInvokerMap = // Set the method invoker map to null
destroyAllInvokers(); // Close all invokers
this.forbidden = // Allow to access
Map&String, Invoker&T&& oldUrlInvokerMap = this.urlInvokerM // local reference
if (invokerUrls.size() == 0 && this.cachedInvokerUrls != null) {
invokerUrls.addAll(this.cachedInvokerUrls);
this.cachedInvokerUrls = new HashSet&URL&();
this.cachedInvokerUrls.addAll(invokerUrls);//Cached invoker urls, convenient for comparison
if (invokerUrls.size() == 0) {
Map&String, Invoker&T&& newUrlInvokerMap = toInvokers(invokerUrls);// Translate url list to Invoker map
Map&String, List&Invoker&T&&& newMethodInvokerMap = toMethodInvokers(newUrlInvokerMap); // Change method name to map Invoker Map
// state change
// If the calculation is wrong, it is not processed.
if (newUrlInvokerMap == null || newUrlInvokerMap.size() == 0) {
logger.error(new IllegalStateException("urls to invokers error .invokerUrls.size :" + invokerUrls.size() + ", invoker.size :0. urls :" + invokerUrls.toString()));
this.methodInvokerMap = multiGroup ? toMergeMethodInvokerMap(newMethodInvokerMap) : newMethodInvokerM
this.urlInvokerMap = newUrlInvokerM
destroyUnusedInvokers(oldUrlInvokerMap, newUrlInvokerMap); // Close the unused Invoker
} catch (Exception e) {
logger.warn("destroyUnusedInvokers error. ", e);
服务调用过程
1.消费端触发请求
在消费者初始化的时候,会生成一个消费者代理注册到容器中,消费调用接口时会把服务接口的method对象和参数放到RpcInvocation对象中,传入MockClusterInvoker.invoke,这个主要是看是否配置mock,一般情况下不走mock,会调用FailOverClusterInvoker.invoke。在服务接口消费者初始化时,接口方法和提供者Invoker对应关系保存在RegistryDirectory的methodInvokerMap中,通过调用的方法名称(或方法名称+第一个参数)获得对应的提供者invoker列表,如注册中心设置了路由规则,对这些invoker根据路由规则进行过滤。
com.alibaba.dubbo.registry.integration.RegistryDirectory.doList(Invocation)
public List&Invoker&T&& doList(Invocation invocation) {
if (forbidden) {
// 1. No service provider 2. Service providers are disabled
throw new RpcException(RpcException.FORBIDDEN_EXCEPTION,
"No provider available from registry " + getUrl().getAddress() + " for service " + getConsumerUrl().getServiceKey() + " on consumer " +
NetUtils.getLocalHost()
+ " use dubbo version " + Version.getVersion() + ", may be providers disabled or not registered ?");
List&Invoker&T&& invokers =
Map&String, List&Invoker&T&&& localMethodInvokerMap = this.methodInvokerM // local reference
if (localMethodInvokerMap != null && localMethodInvokerMap.size() & 0) {
String methodName = RpcUtils.getMethodName(invocation);
Object[] args = RpcUtils.getArguments(invocation);
if (args != null && args.length & 0 && args[0] != null
&& (args[0] instanceof String || args[0].getClass().isEnum())) {
invokers = localMethodInvokerMap.get(methodName + "." + args[0]); // The routing can be enumerated according to the first parameter
if (invokers == null) {
invokers = localMethodInvokerMap.get(methodName);
if (invokers == null) {
invokers = localMethodInvokerMap.get(Constants.ANY_VALUE);
if (invokers == null) {
Iterator&List&Invoker&T&&& iterator = localMethodInvokerMap.values().iterator();
if (iterator.hasNext()) {
invokers = iterator.next();
return invokers == null ? new ArrayList&Invoker&T&&(0) :
com.alibaba.dubbo.rpc.cluster.directory.AbstractDirectory.list(Invocation)
public List&Invoker&T&& list(Invocation invocation) throws RpcException {
if (destroyed) {
throw new RpcException("Directory already destroyed .url: " + getUrl());
List&Invoker&T&& invokers = doList(invocation);
List&Router& localRouters = this. // local reference
if (localRouters != null && localRouters.size() & 0) {
for (Router router : localRouters) {
if (router.getUrl() == null || router.getUrl().getParameter(Constants.RUNTIME_KEY, false)) {
invokers = router.route(invokers, getConsumerUrl(), invocation);
} catch (Throwable t) {
logger.error("Failed to execute router: " + getUrl() + ", cause: " + t.getMessage(), t);
读取到所有符合条件的服务提供者invoker之后,由LoadBalance组件执行负载均衡,从中挑选一个invoker进行调用,框架内置支持的负载均衡算法包括random(随机)、roundrobin(R-R循环)、leastactive(最不活跃)、consistenthash(一致性hash),应用可配置,默认random。
com.alibaba.dubbo.rpc.cluster.support.FailoverClusterInvoker.doInvoke
public Result doInvoke(Invocation invocation, final List&Invoker&T&& invokers, LoadBalance loadbalance) throws RpcException {
List&Invoker&T&& copyinvokers =
checkInvokers(copyinvokers, invocation);
int len = getUrl().getMethodParameter(invocation.getMethodName(), Constants.RETRIES_KEY, Constants.DEFAULT_RETRIES) + 1;
if (len &= 0) {
// retry loop.
RpcException le = // last exception.
List&Invoker&T&& invoked = new ArrayList&Invoker&T&&(copyinvokers.size()); // invoked invokers.
Set&String& providers = new HashSet&String&(len);
for (int i = 0; i & i++) {
//Reselect before retry to avoid a change of candidate `invokers`.
//NOTE: if `invokers` changed, then `invoked` also lose accuracy.
if (i & 0) {
checkWhetherDestroyed();
copyinvokers = list(invocation);
// check again
checkInvokers(copyinvokers, invocation);
Invoker&T& invoker = select(loadbalance, invocation, copyinvokers, invoked);
invoked.add(invoker);
RpcContext.getContext().setInvokers((List) invoked);
Result result = invoker.invoke(invocation);
if (le != null && logger.isWarnEnabled()) {
logger.warn("Although retry the method " + invocation.getMethodName()
+ " in the service " + getInterface().getName()
+ " was successful by the provider " + invoker.getUrl().getAddress()
+ ", but there have been failed providers " + providers
+ " (" + providers.size() + "/" + copyinvokers.size()
+ ") from the registry " + directory.getUrl().getAddress()
+ " on the consumer " + NetUtils.getLocalHost()
+ " using the dubbo version " + Version.getVersion() + ". Last error is: "
+ le.getMessage(), le);
} catch (RpcException e) {
if (e.isBiz()) { // biz exception.
} catch (Throwable e) {
le = new RpcException(e.getMessage(), e);
} finally {
providers.add(invoker.getUrl().getAddress());
throw new RpcException(le != null ? le.getCode() : 0, "Failed to invoke the method "
+ invocation.getMethodName() + " in the service " + getInterface().getName()
+ ". Tried " + len + " times of the providers " + providers
+ " (" + providers.size() + "/" + copyinvokers.size()
+ ") from the registry " + directory.getUrl().getAddress()
+ " on the consumer " + NetUtils.getLocalHost() + " using the dubbo version "
+ Version.getVersion() + ". Last error is: "
+ (le != null ? le.getMessage() : ""), le != null && le.getCause() != null ? le.getCause() : le);
methodInvokerMap保存的是持有DubboInvoker(dubbo协议)实例的InvokerDelegete对象,是Invoker-Filter链的头部,先激活Filter连然后最终调到DubboInvoker.invoke(RpcInvocation)。
com.alibaba.dubbo.rpc.protocol.dubbo.DubboInvoker.doInvoke
protected Result doInvoke(final Invocation invocation) throws Throwable {
RpcInvocation inv = (RpcInvocation)
final String methodName = RpcUtils.getMethodName(invocation);
inv.setAttachment(Constants.PATH_KEY, getUrl().getPath());
inv.setAttachment(Constants.VERSION_KEY, version);
ExchangeClient currentC
if (clients.length == 1) {
currentClient = clients[0];
currentClient = clients[index.getAndIncrement() % clients.length];
boolean isAsync = RpcUtils.isAsync(getUrl(), invocation);
boolean isOneway = RpcUtils.isOneway(getUrl(), invocation);
int timeout = getUrl().getMethodParameter(methodName, Constants.TIMEOUT_KEY, Constants.DEFAULT_TIMEOUT);
if (isOneway) {
boolean isSent = getUrl().getMethodParameter(methodName, Constants.SENT_KEY, false);
currentClient.send(inv, isSent);
RpcContext.getContext().setFuture(null);
return new RpcResult();
} else if (isAsync) {
ResponseFuture future = currentClient.request(inv, timeout);
RpcContext.getContext().setFuture(new FutureAdapter&Object&(future));
return new RpcResult();
RpcContext.getContext().setFuture(null);
return (Result) currentClient.request(inv, timeout).get();
} catch (TimeoutException e) {
throw new RpcException(RpcException.TIMEOUT_EXCEPTION, "Invoke remote method timeout. method: " + invocation.getMethodName() + ", provider: " + getUrl() + ", cause: " + e.getMessage(), e);
} catch (RemotingException e) {
throw new RpcException(RpcException.NETWORK_EXCEPTION, "Failed to invoke remote method: " + invocation.getMethodName() + ", provider: " + getUrl() + ", cause: " + e.getMessage(), e);
同步调用时调用HeaderExchangeClient.request,然后调用HeaderExchangeChannel.request。
com.alibaba.dubbo.remoting.exchange.support.header.HeaderExchangeChannel.request
public ResponseFuture request(Object request, int timeout) throws RemotingException {
if (closed) {
throw new RemotingException(this.getLocalAddress(), null, "Failed to send request " + request + ", cause: The channel " + this + " is closed!");
// create request.
Request req = new Request();
req.setVersion("2.0.0");
req.setTwoWay(true);
req.setData(request);
DefaultFuture future = new DefaultFuture(channel, req, timeout);
channel.send(req);
} catch (RemotingException e) {
future.cancel();
这个channel对象就是和服务端打交道的NettyClient实例,NettyClient.send调用NettyChannel.send。
com.alibaba.dubbo.remoting.transport.netty.NettyChannel.send
public void send(Object message, boolean sent) throws RemotingException {
super.send(message, sent);
boolean success =
int timeout = 0;
ChannelFuture future = channel.write(message);
if (sent) {
timeout = getUrl().getPositiveParameter(Constants.TIMEOUT_KEY, Constants.DEFAULT_TIMEOUT);
success = future.await(timeout);
Throwable cause = future.getCause();
if (cause != null) {
} catch (Throwable e) {
throw new RemotingException(this, "Failed to send message " + message + " to " + getRemoteAddress() + ", cause: " + e.getMessage(), e);
if (!success) {
throw new RemotingException(this, "Failed to send message " + message + " to " + getRemoteAddress()
+ "in timeout(" + timeout + "ms) limit");
2.消费端请求编码
根据协议,消息中写入16个字节的消息头:
1-2字节,固定的魔数
第3个字节,第8位存储数据类型是请求数据还是响应数据,其它7位存储序列化类型,约定和服务端的序列化-反序列化协议
5-12个字节,请求id
13-16个字节,请求数据长度
com.alibaba.dubbo.remoting.exchange.codec.ExchangeCodec.encodeRequest
protected void encodeRequest(Channel channel, ChannelBuffer buffer, Request req) throws IOException {
Serialization serialization = getSerialization(channel);
// header.
byte[] header = new byte[HEADER_LENGTH];
// set magic number.
Bytes.short2bytes(MAGIC, header);
// set request and serialization flag.
header[2] = (byte) (FLAG_REQUEST | serialization.getContentTypeId());
if (req.isTwoWay()) header[2] |= FLAG_TWOWAY;
if (req.isEvent()) header[2] |= FLAG_EVENT;
// set request id.
Bytes.long2bytes(req.getId(), header, 4);
// encode request data.
int savedWriteIndex = buffer.writerIndex();
buffer.writerIndex(savedWriteIndex + HEADER_LENGTH);
ChannelBufferOutputStream bos = new ChannelBufferOutputStream(buffer);
ObjectOutput out = serialization.serialize(channel.getUrl(), bos);
if (req.isEvent()) {
encodeEventData(channel, out, req.getData());
encodeRequestData(channel, out, req.getData());
out.flushBuffer();
if (out instanceof Cleanable) {
((Cleanable) out).cleanup();
bos.flush();
bos.close();
int len = bos.writtenBytes();
checkPayload(channel, len);
Bytes.int2bytes(len, header, 12);
buffer.writerIndex(savedWriteIndex);
buffer.writeBytes(header); // write header.
buffer.writerIndex(savedWriteIndex + HEADER_LENGTH + len);
3.服务方请求解码
com.alibaba.dubbo.rpc.protocol.dubbo.DubboCodec.decodeBody
protected Object decodeBody(Channel channel, InputStream is, byte[] header) throws IOException {
byte flag = header[2], proto = (byte) (flag & SERIALIZATION_MASK);
Serialization s = CodecSupport.getSerialization(channel.getUrl(), proto);
// get request id.
long id = Bytes.bytes2long(header, 4);
if ((flag & FLAG_REQUEST) == 0) {
// decode response.
Response res = new Response(id);
if ((flag & FLAG_EVENT) != 0) {
res.setEvent(Response.HEARTBEAT_EVENT);
// get status.
byte status = header[3];
res.setStatus(status);
if (status == Response.OK) {
if (res.isHeartbeat()) {
data = decodeHeartbeatData(channel, deserialize(s, channel.getUrl(), is));
} else if (res.isEvent()) {
data = decodeEventData(channel, deserialize(s, channel.getUrl(), is));
DecodeableRpcR
if (channel.getUrl().getParameter(
Constants.DECODE_IN_IO_THREAD_KEY,
Constants.DEFAULT_DECODE_IN_IO_THREAD)) {
result = new DecodeableRpcResult(channel, res, is,
(Invocation) getRequestData(id), proto);
result.decode();
result = new DecodeableRpcResult(channel, res,
new UnsafeByteArrayInputStream(readMessageData(is)),
(Invocation) getRequestData(id), proto);
res.setResult(data);
} catch (Throwable t) {
if (log.isWarnEnabled()) {
log.warn("Decode response failed: " + t.getMessage(), t);
res.setStatus(Response.CLIENT_ERROR);
res.setErrorMessage(StringUtils.toString(t));
res.setErrorMessage(deserialize(s, channel.getUrl(), is).readUTF());
// decode request.
Request req = new Request(id);
req.setVersion("2.0.0");
req.setTwoWay((flag & FLAG_TWOWAY) != 0);
if ((flag & FLAG_EVENT) != 0) {
req.setEvent(Request.HEARTBEAT_EVENT);
if (req.isHeartbeat()) {
data = decodeHeartbeatData(channel, deserialize(s, channel.getUrl(), is));
} else if (req.isEvent()) {
data = decodeEventData(channel, deserialize(s, channel.getUrl(), is));
DecodeableRpcI
if (channel.getUrl().getParameter(
Constants.DECODE_IN_IO_THREAD_KEY,
Constants.DEFAULT_DECODE_IN_IO_THREAD)) {
inv = new DecodeableRpcInvocation(channel, req, is, proto);
inv.decode();
inv = new DecodeableRpcInvocation(channel, req,
new UnsafeByteArrayInputStream(readMessageData(is)), proto);
req.setData(data);
} catch (Throwable t) {
if (log.isWarnEnabled()) {
log.warn("Decode request failed: " + t.getMessage(), t);
// bad request
req.setBroken(true);
req.setData(t);
4.服务端处理请求
com.alibaba.dubbo.rpc.protocol.dubbo.DubboProtocol
private ExchangeHandler requestHandler = new ExchangeHandlerAdapter() {
public Object reply(ExchangeChannel channel, Object message) throws RemotingException {
if (message instanceof Invocation) {
Invocation inv = (Invocation)
Invoker&?& invoker = getInvoker(channel, inv);
// need to consider backward-compatibility if it's a callback
if (Boolean.TRUE.toString().equals(inv.getAttachments().get(IS_CALLBACK_SERVICE_INVOKE))) {
String methodsStr = invoker.getUrl().getParameters().get("methods");
boolean hasMethod =
if (methodsStr == null || methodsStr.indexOf(",") == -1) {
hasMethod = inv.getMethodName().equals(methodsStr);
String[] methods = methodsStr.split(",");
for (String method : methods) {
if (inv.getMethodName().equals(method)) {
hasMethod =
if (!hasMethod) {
logger.warn(new IllegalStateException("The methodName " + inv.getMethodName() + " not found in callback service interface ,invoke will be ignored. please update the api interface. url is:" + invoker.getUrl()) + " ,invocation is :" + inv);
RpcContext.getContext().setRemoteAddress(channel.getRemoteAddress());
return invoker.invoke(inv);
throw new RemotingException(channel, "Unsupported request: " + message == null ? null : (message.getClass().getName() + ": " + message) + ", channel: consumer: " + channel.getRemoteAddress() + " --& provider: " + channel.getLocalAddress());
查找提供端请求对应的Invoker,在接口提供者初始化时,每个接口都会创建一个Invoker和Exporter,Exporter持有invoker实例,Exporter对象保存在DubboProtocol的exporterMap中,key是由URL生成的serviceKey,此时通过Invocation中的信息就可还原该serviceKey并且找到对应的Exporter和Invoker,在分析提供者初始化代码时知道它是Invoker-Filter的头节点,激活Filter后调用由ProxyFactory生成的Invoker。
5.服务端响应结果编码
在NettyCodecAdapter. encoder对响应结果进行编码,还是通过Code2组件和请求编码时使用的组件一样,把响应类型和响应结果依次写回到客户端,根据协议会写入16个字节的数据头,包括:
1-2字节魔数
第3个字节,序列化组件类型,约定和客户端的序列化-反序列化协议
第4个字节,响应状态,是OK还是error
5-13个字节,响应id,这里的id和request中的id一样
13-16个字节,响应数据长度
com.alibaba.dubbo.remoting.exchange.codec.ExchangeCodec.encodeResponse
protected void encodeResponse(Channel channel, ChannelBuffer buffer, Response res) throws IOException {
int savedWriteIndex = buffer.writerIndex();
Serialization serialization = getSerialization(channel);
// header.
byte[] header = new byte[HEADER_LENGTH];
// set magic number.
Bytes.short2bytes(MAGIC, header);
// set request and serialization flag.
header[2] = serialization.getContentTypeId();
if (res.isHeartbeat()) header[2] |= FLAG_EVENT;
// set response status.
byte status = res.getStatus();
header[3] =
// set request id.
Bytes.long2bytes(res.getId(), header, 4);
buffer.writerIndex(savedWriteIndex + HEADER_LENGTH);
ChannelBufferOutputStream bos = new ChannelBufferOutputStream(buffer);
ObjectOutput out = serialization.serialize(channel.getUrl(), bos);
// encode response data or error message.
if (status == Response.OK) {
if (res.isHeartbeat()) {
encodeHeartbeatData(channel, out, res.getResult());
encodeResponseData(channel, out, res.getResult());
} else out.writeUTF(res.getErrorMessage());
out.flushBuffer();
if (out instanceof Cleanable) {
((Cleanable) out).cleanup();
bos.flush();
bos.close();
int len = bos.writtenBytes();
checkPayload(channel, len);
Bytes.int2bytes(len, header, 12);
buffer.writerIndex(savedWriteIndex);
buffer.writeBytes(header); // write header.
buffer.writerIndex(savedWriteIndex + HEADER_LENGTH + len);
} catch (Throwable t) {
// clear buffer
buffer.writerIndex(savedWriteIndex);
// send error message to Consumer, otherwise, Consumer will wait till timeout.
if (!res.isEvent() && res.getStatus() != Response.BAD_RESPONSE) {
Response r = new Response(res.getId(), res.getVersion());
r.setStatus(Response.BAD_RESPONSE);
if (t instanceof ExceedPayloadLimitException) {
logger.warn(t.getMessage(), t);
r.setErrorMessage(t.getMessage());
channel.send(r);
} catch (RemotingException e) {
logger.warn("Failed to send bad_response info back: " + t.getMessage() + ", cause: " + e.getMessage(), e);
// FIXME log error message in Codec and handle in caught() of IoHanndler?
logger.warn("Fail to encode response: " + res + ", send bad_response info instead, cause: " + t.getMessage(), t);
r.setErrorMessage("Failed to send response: " + res + ", cause: " + StringUtils.toString(t));
channel.send(r);
} catch (RemotingException e) {
logger.warn("Failed to send bad_response info back: " + res + ", cause: " + e.getMessage(), e);
// Rethrow exception
if (t instanceof IOException) {
throw (IOException)
} else if (t instanceof RuntimeException) {
throw (RuntimeException)
} else if (t instanceof Error) {
throw (Error)
throw new RuntimeException(t.getMessage(), t);
6.消费端响应结果解码
对返回结果三种情况作了处理,无返回值、有返回值和返回异常。
com.alibaba.dubbo.rpc.protocol.dubbo.DecodeableRpcResult.decode
public Object decode(Channel channel, InputStream input) throws IOException {
ObjectInput in = CodecSupport.getSerialization(channel.getUrl(), serializationType)
.deserialize(channel.getUrl(), input);
byte flag = in.readByte();
switch (flag) {
case DubboCodec.RESPONSE_NULL_VALUE:
case DubboCodec.RESPONSE_VALUE:
Type[] returnType = RpcUtils.getReturnTypes(invocation);
setValue(returnType == null || returnType.length == 0 ? in.readObject() :
(returnType.length == 1 ? in.readObject((Class&?&) returnType[0])
: in.readObject((Class&?&) returnType[0], returnType[1])));
} catch (ClassNotFoundException e) {
throw new IOException(StringUtils.toString("Read response data failed.", e));
case DubboCodec.RESPONSE_WITH_EXCEPTION:
Object obj = in.readObject();
if (obj instanceof Throwable == false)
throw new IOException("Response data error, expect Throwable, but get " + obj);
setException((Throwable) obj);
} catch (ClassNotFoundException e) {
throw new IOException(StringUtils.toString("Read response data failed.", e));
throw new IOException("Unknown result flag, expect '0' '1' '2', get " + flag);
if (in instanceof Cleanable) {
((Cleanable) in).cleanup();
在消费者触发请求的代码中可以看到,消费端调用接口的时候请求写到服务端之后,会调用DefaultFuture.get阻塞等待响应结果
Spring Cloud为开发人员提供了快速构建分布式系统中一些常见模式的工具(例如配置管理,服务发现,断路器,智能路由,微代理,控制总线)。分布式系统的协调导致了样板模式, 使用Spring Cloud开发人员可以快速地支持实现这些模式的服务和应用程序。他们将在任何分布式...
dubbo暴露服务有两种情况,一种是设置了延迟暴露(比如delay=&5000&),另外一种是没有设置延迟暴露或者延迟设置为-1(delay=&-1&): 设置了延迟暴露,dubbo在Spring实例化bean(initializeBean)的时候会对实现了Initiali...
架构师之路:从无到有搭建中小型互联网公司后台服务架构与运维架构http://www.roncoo.com/course/view/ae1dbbaf7d10b 概述dubbo支持多种远程调用方式,例如dubbo RPC(二进制序列化 + ...
概述 dubbo支持多种远程调用方式,例如dubbo RPC(二进制序列化 + tcp协议)、http invoker(二进制序列化 + http协议,至少在开源版本没发现对文本序列化的支持)、hessian(二进制序列化 + http协议)、WebServices (文本...
概述 dubbo支持多种远程调用方式,例如dubbo RPC(二进制序列化 + tcp协议)、http invoker(二进制序列化 + http协议,至少在开源版本没发现对文本序列化的支持)、hessian(二进制序列化 + http协议)、WebServices (文本...
午后一点,踏上久违的骑行之路,轻风微拂,心情舒畅。
坝子上一片绿意盎然,宛如小阳春。天空湛蓝如洗,阳光明媚温暖,时不时会有各种鸟的此起彼伏,偶尔传来清脆的鸟鸣,似有误入“草长莺飞”的江南的恍惚。[偷笑][偷笑]
来到洄溜,清真寺、老街、轮渡是不能错过的。 清真寺依旧...
这是一部近年来华语影坛少有的现实主义佳作,控诉着香港日益堕落的媒体环境。 智叔因自己的女儿被奸杀,但是杀人犯却因为找了假证被无罪释放。当他找到真相再度要求重审时,却发现香港竟然没有一罪两审的规定,他日日夜夜坐在政府门口呈上“一罪两审”法案的申诉,却因势单力薄而无人问津,凶手...
JEESZ的消息服务平台已经抛弃了之前的ActiveMQ,改用高吞吐量比较大的Kafka分布式消息中间件方案: JEESZ-kafka消息平台使用spring+kafka的集成方案,详情如下: 1.使用最高版本2.1.0.RELEASE集成jar包:spring-integ...
我家在天津师范大学北院的家属区。出院后没多日子,妻子让我上街转一转,说这叫“融入社会”。我再三推托,小声嘟嚷:“再等几天吧,现在这个样子,要是碰上熟人,多不好意思……”妻子看出了我的心思,她进一步劝我:“碰上熟人有什么不好意思,吃五谷杂粮哪有不得病呀,得了病怕什么,病...}

我要回帖

更多关于 商标注册查询 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信