package com.alibaba.dubbo.remoting;
import com.alibaba.dubbo.common.extension.ExtensionLoader;
/**
* 网络传输自适应类,底层默认使用的netty
*/
public class Transporter$Adaptive implements com.alibaba.dubbo.remoting.Transporter {
public com.alibaba.dubbo.remoting.Client connect(com.alibaba.dubbo.common.URL arg0, com.alibaba.dubbo.remoting.ChannelHandler arg1) throws com.alibaba.dubbo.remoting.RemotingException {
if (arg0 == null) throw new IllegalArgumentException("url == null");
com.alibaba.dubbo.common.URL url = arg0;
String extName = url.getParameter("client", url.getParameter("transporter", "netty"));
if (extName == null)
throw new IllegalStateException("Fail to get extension(com.alibaba.dubbo.remoting.Transporter) name from url(" + url.toString() + ") use keys([client, transporter])");
Dubbo动态生成的Adaptive自适应类之Transporter$Adaptive
最新推荐文章于 2024-01-22 19:15:27 发布
本文介绍了Dubbo中Transporter$Adaptive类的工作原理,它作为网络传输的自适应类,根据URL参数动态选择合适的Transporter实现,如netty。在connect和bind方法中,通过ExtensionLoader获取具体扩展实现,实现了服务的动态绑定和连接。
摘要由CSDN通过智能技术生成