赞
踩
查看Transport的代理类并反编译:
- [arthas@11201]$ sc *Transporter*
- com.alibaba.dubbo.remoting.Transporter
- com.alibaba.dubbo.remoting.Transporter$Adaptive
- com.alibaba.dubbo.remoting.Transporters
- com.alibaba.dubbo.remoting.transport.mina.MinaTransporter
- com.alibaba.dubbo.remoting.transport.netty.NettyTransporter
- com.alibaba.dubbo.remoting.zookeeper.ZookeeperTransporter
- com.alibaba.dubbo.remoting.zookeeper.ZookeeperTransporter$Adaptive
- com.alibaba.dubbo.remoting.zookeeper.curator.CuratorZookeeperTransporter
- com.alibaba.dubbo.remoting.zookeeper.zkclient.ZkclientZookeeperTransporter
- Affect(row-cnt:9) cost in 7 ms.
- [arthas@11201]$ jad com.alibaba.dubbo.remoting.Transporter$Adaptive
-
- ClassLoader:
- +-sun.misc.Launcher$AppClassLoader@18b4aac2
- +-sun.misc.Launcher$ExtClassLoader@369f73a2
-
- Location:
- /Users/luzhen/Downloads/dubbo-2.6.5/dubbo-common/target/classes/
-
- /*
- * Decompiled with CFR.
- *
- * Could not load the following classes:
- * com.alibaba.dubbo.common.URL
- * com.alibaba.dubbo.common.extension.ExtensionLoader
- * com.alibaba.dubbo.remoting.ChannelHandler
- * com.alibaba.dubbo.remoting.Client
- * com.alibaba.dubbo.remoting.RemotingException
- * com.alibaba.dubbo.remoting.Server
- * com.alibaba.dubbo.remoting.Transporter
- */
- package com.alibaba.dubbo.remoting;
-
- import com.alibaba.dubbo.common.URL;
- import com.alibaba.dubbo.common.extension.ExtensionLoader;
- import com.alibaba.dubbo.remoting.ChannelHandler;
- import com.alibaba.dubbo.remoting.Client;
- import com.alibaba.dubbo.remoting.RemotingException;
- import com.alibaba.dubbo.remoting.Server;
- import com.alibaba.dubbo.remoting.Transporter;
-
- public class Transporter$Adaptive
- implements Transporter {
- public Client connect(URL uRL, ChannelHandler channelHandler) throws RemotingException {
- if (uRL == null) {
- throw new IllegalArgumentException("url == null");
- }
- URL uRL2 = uRL;
- String string = uRL2.getParameter("client", uRL2.getParameter("transporter", "netty"));
- if (string == null) {
- throw new IllegalStateException(new StringBuffer().append("Fail to get extension(com.alibaba.dubbo.remoting.Transporter) name from url(").append(uRL2.toString()).append(") use keys([client, transporter])").toString());
- }
- Transporter transporter = (Transporter)ExtensionLoader.getExtensionLoader(Transporter.class).getExtension(string);
- return transporter.connect(uRL, channelHandler);
- }
-
- public Server bind(URL uRL, ChannelHandler channelHandler) throws RemotingException {
- if (uRL == null) {
- throw new IllegalArgumentException("url == null");
- }
- URL uRL2 = uRL;
- String string = uRL2.getParameter("server", uRL2.getParameter("transporter", "netty"));
- if (string == null) {
- throw new IllegalStateException(new StringBuffer().append("Fail to get extension(com.alibaba.dubbo.remoting.Transporter) name from url(").append(uRL2.toString()).append(") use keys([server, transporter])").toString());
- }
- Transporter transporter = (Transporter)ExtensionLoader.getExtensionLoader(Transporter.class).getExtension(string);
- return transporter.bind(uRL, channelHandler);
- }
- }
-
- Affect(row-cnt:1) cost in 950 ms.
- [arthas@11201]$

Transporter$Adaptive
- package com.alibaba.dubbo.remoting;
-
- import com.alibaba.dubbo.common.URL;
- import com.alibaba.dubbo.common.extension.ExtensionLoader;
- import com.alibaba.dubbo.remoting.ChannelHandler;
- import com.alibaba.dubbo.remoting.Client;
- import com.alibaba.dubbo.remoting.RemotingException;
- import com.alibaba.dubbo.remoting.Server;
- import com.alibaba.dubbo.remoting.Transporter;
-
- public class Transporter$Adaptive
- implements Transporter {
- public Client connect(URL uRL, ChannelHandler channelHandler) throws RemotingException {
- if (uRL == null) {
- throw new IllegalArgumentException("url == null");
- }
- URL uRL2 = uRL;
- //如果URL中没有transporter参数 那么默认用spi=netty的类
- String string = uRL2.getParameter("client", uRL2.getParameter("transporter", "netty"));
- if (string == null) {
- throw new IllegalStateException(new StringBuffer().append("Fail to get extension(com.alibaba.dubbo.remoting.Transporter) name from url(").append(uRL2.toString()).append(") use keys([client, transporter])").toString());
- }
- Transporter transporter = (Transporter)ExtensionLoader.getExtensionLoader(Transporter.class).getExtension(string);
- return transporter.connect(uRL, channelHandler);
- }
-
- public Server bind(URL uRL, ChannelHandler channelHandler) throws RemotingException {
- if (uRL == null) {
- throw new IllegalArgumentException("url == null");
- }
- URL uRL2 = uRL;
- String string = uRL2.getParameter("server", uRL2.getParameter("transporter", "netty"));
- if (string == null) {
- throw new IllegalStateException(new StringBuffer().append("Fail to get extension(com.alibaba.dubbo.remoting.Transporter) name from url(").append(uRL2.toString()).append(") use keys([server, transporter])").toString());
- }
- Transporter transporter = (Transporter)ExtensionLoader.getExtensionLoader(Transporter.class).getExtension(string);
- return transporter.bind(uRL, channelHandler);
- }
- }

Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。