dubbo源码分析14——DubboProtocol的export方法分析

Posted 源码王

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了dubbo源码分析14——DubboProtocol的export方法分析相关的知识,希望对你有一定的参考价值。

先列出源码:

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);
        
        //export an stub service for dispaching event
        Boolean isStubSupportEvent = url.getParameter(Constants.STUB_EVENT_KEY,Constants.DEFAULT_STUB_EVENT);
        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 ){
                if (logger.isWarnEnabled()){
                    logger.warn(new IllegalStateException("consumer [" +url.getParameter(Constants.INTERFACE_KEY) +
                            "], has set stubproxy support event ,but no stub methods founded."));
                }
            } else {
                stubServiceMethodsMap.put(url.getServiceKey(), stubServiceMethods);
            }
        }

        openServer(url);

        // modified by lishen
        optimizeSerialization(url);

        return exporter;
    }

 

以上是关于dubbo源码分析14——DubboProtocol的export方法分析的主要内容,如果未能解决你的问题,请参考以下文章

源码分析Dubbo专栏

源码分析Dubbo专栏

dubbo 源码 v2.7 分析:核心机制

手撕源码Dubbo工作原理&源码分析

Dubbo实现的源码分析

1.dubbo源码分析之dubbo项目结构