当前位置:   article > 正文

用Arthas查看Dubbo中生成的的Transport的适配类Transporter$Adaptive_在idea 中 如何查看 dubbo 生成的 $adaptive文件

在idea 中 如何查看 dubbo 生成的 $adaptive文件

查看Transport的代理类并反编译:

  1. [arthas@11201]$ sc *Transporter*
  2. com.alibaba.dubbo.remoting.Transporter
  3. com.alibaba.dubbo.remoting.Transporter$Adaptive
  4. com.alibaba.dubbo.remoting.Transporters
  5. com.alibaba.dubbo.remoting.transport.mina.MinaTransporter
  6. com.alibaba.dubbo.remoting.transport.netty.NettyTransporter
  7. com.alibaba.dubbo.remoting.zookeeper.ZookeeperTransporter
  8. com.alibaba.dubbo.remoting.zookeeper.ZookeeperTransporter$Adaptive
  9. com.alibaba.dubbo.remoting.zookeeper.curator.CuratorZookeeperTransporter
  10. com.alibaba.dubbo.remoting.zookeeper.zkclient.ZkclientZookeeperTransporter
  11. Affect(row-cnt:9) cost in 7 ms.
  12. [arthas@11201]$ jad com.alibaba.dubbo.remoting.Transporter$Adaptive
  13. ClassLoader:
  14. +-sun.misc.Launcher$AppClassLoader@18b4aac2
  15. +-sun.misc.Launcher$ExtClassLoader@369f73a2
  16. Location:
  17. /Users/luzhen/Downloads/dubbo-2.6.5/dubbo-common/target/classes/
  18. /*
  19. * Decompiled with CFR.
  20. *
  21. * Could not load the following classes:
  22. * com.alibaba.dubbo.common.URL
  23. * com.alibaba.dubbo.common.extension.ExtensionLoader
  24. * com.alibaba.dubbo.remoting.ChannelHandler
  25. * com.alibaba.dubbo.remoting.Client
  26. * com.alibaba.dubbo.remoting.RemotingException
  27. * com.alibaba.dubbo.remoting.Server
  28. * com.alibaba.dubbo.remoting.Transporter
  29. */
  30. package com.alibaba.dubbo.remoting;
  31. import com.alibaba.dubbo.common.URL;
  32. import com.alibaba.dubbo.common.extension.ExtensionLoader;
  33. import com.alibaba.dubbo.remoting.ChannelHandler;
  34. import com.alibaba.dubbo.remoting.Client;
  35. import com.alibaba.dubbo.remoting.RemotingException;
  36. import com.alibaba.dubbo.remoting.Server;
  37. import com.alibaba.dubbo.remoting.Transporter;
  38. public class Transporter$Adaptive
  39. implements Transporter {
  40. public Client connect(URL uRL, ChannelHandler channelHandler) throws RemotingException {
  41. if (uRL == null) {
  42. throw new IllegalArgumentException("url == null");
  43. }
  44. URL uRL2 = uRL;
  45. String string = uRL2.getParameter("client", uRL2.getParameter("transporter", "netty"));
  46. if (string == null) {
  47. 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());
  48. }
  49. Transporter transporter = (Transporter)ExtensionLoader.getExtensionLoader(Transporter.class).getExtension(string);
  50. return transporter.connect(uRL, channelHandler);
  51. }
  52. public Server bind(URL uRL, ChannelHandler channelHandler) throws RemotingException {
  53. if (uRL == null) {
  54. throw new IllegalArgumentException("url == null");
  55. }
  56. URL uRL2 = uRL;
  57. String string = uRL2.getParameter("server", uRL2.getParameter("transporter", "netty"));
  58. if (string == null) {
  59. 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());
  60. }
  61. Transporter transporter = (Transporter)ExtensionLoader.getExtensionLoader(Transporter.class).getExtension(string);
  62. return transporter.bind(uRL, channelHandler);
  63. }
  64. }
  65. Affect(row-cnt:1) cost in 950 ms.
  66. [arthas@11201]$

Transporter$Adaptive

  1. package com.alibaba.dubbo.remoting;
  2. import com.alibaba.dubbo.common.URL;
  3. import com.alibaba.dubbo.common.extension.ExtensionLoader;
  4. import com.alibaba.dubbo.remoting.ChannelHandler;
  5. import com.alibaba.dubbo.remoting.Client;
  6. import com.alibaba.dubbo.remoting.RemotingException;
  7. import com.alibaba.dubbo.remoting.Server;
  8. import com.alibaba.dubbo.remoting.Transporter;
  9. public class Transporter$Adaptive
  10. implements Transporter {
  11. public Client connect(URL uRL, ChannelHandler channelHandler) throws RemotingException {
  12. if (uRL == null) {
  13. throw new IllegalArgumentException("url == null");
  14. }
  15. URL uRL2 = uRL;
  16. //如果URL中没有transporter参数 那么默认用spi=netty的类
  17. String string = uRL2.getParameter("client", uRL2.getParameter("transporter", "netty"));
  18. if (string == null) {
  19. 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());
  20. }
  21. Transporter transporter = (Transporter)ExtensionLoader.getExtensionLoader(Transporter.class).getExtension(string);
  22. return transporter.connect(uRL, channelHandler);
  23. }
  24. public Server bind(URL uRL, ChannelHandler channelHandler) throws RemotingException {
  25. if (uRL == null) {
  26. throw new IllegalArgumentException("url == null");
  27. }
  28. URL uRL2 = uRL;
  29. String string = uRL2.getParameter("server", uRL2.getParameter("transporter", "netty"));
  30. if (string == null) {
  31. 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());
  32. }
  33. Transporter transporter = (Transporter)ExtensionLoader.getExtensionLoader(Transporter.class).getExtension(string);
  34. return transporter.bind(uRL, channelHandler);
  35. }
  36. }

 

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/笔触狂放9/article/detail/938206
推荐阅读
相关标签
  

闽ICP备14008679号