ProxyFactory$Adaptive源码

2021-06-29  本文已影响0人  宁静的猫
package com.alibaba.dubbo.rpc;

import com.alibaba.dubbo.common.Node;
import com.alibaba.dubbo.common.URL;
import com.alibaba.dubbo.common.extension.ExtensionLoader;

public class ProxyFactory$Adaptive implements ProxyFactory
{
  public Object getProxy(Invoker paramInvoker)
    throws RpcException
  {
    if (paramInvoker == null) {
      throw new IllegalArgumentException("com.alibaba.dubbo.rpc.Invoker argument == null");
    }
    if (paramInvoker.getUrl() == null) {
      throw new IllegalArgumentException("com.alibaba.dubbo.rpc.Invoker argument getUrl() == null");
    }
    URL localURL = paramInvoker.getUrl();
    String str = localURL.getParameter("proxy", "javassist");
    if (str == null) {
      throw new IllegalStateException("Fail to get extension(com.alibaba.dubbo.rpc.ProxyFactory) name from url(" + localURL.toString() + ") use keys([proxy])");
    }
    ProxyFactory localProxyFactory = (ProxyFactory)ExtensionLoader.getExtensionLoader(ProxyFactory.class).getExtension(str);
    return localProxyFactory.getProxy(paramInvoker);
  }
  
  public Object getProxy(Invoker paramInvoker, boolean paramBoolean)
    throws RpcException
  {
    if (paramInvoker == null) {
      throw new IllegalArgumentException("com.alibaba.dubbo.rpc.Invoker argument == null");
    }
    if (paramInvoker.getUrl() == null) {
      throw new IllegalArgumentException("com.alibaba.dubbo.rpc.Invoker argument getUrl() == null");
    }
    URL localURL = paramInvoker.getUrl();
    String str = localURL.getParameter("proxy", "javassist");
    if (str == null) {
      throw new IllegalStateException("Fail to get extension(com.alibaba.dubbo.rpc.ProxyFactory) name from url(" + localURL.toString() + ") use keys([proxy])");
    }
    ProxyFactory localProxyFactory = (ProxyFactory)ExtensionLoader.getExtensionLoader(ProxyFactory.class).getExtension(str);
    return localProxyFactory.getProxy(paramInvoker, paramBoolean);
  }
  
  public Invoker getInvoker(Object paramObject, Class paramClass, URL paramURL)
    throws RpcException
  {
    if (paramURL == null) {
      throw new IllegalArgumentException("url == null");
    }
    URL localURL = paramURL;
    String str = localURL.getParameter("proxy", "javassist");
    if (str == null) {
      throw new IllegalStateException("Fail to get extension(com.alibaba.dubbo.rpc.ProxyFactory) name from url(" + localURL.toString() + ") use keys([proxy])");
    }
    ProxyFactory localProxyFactory = (ProxyFactory)ExtensionLoader.getExtensionLoader(ProxyFactory.class).getExtension(str);
    return localProxyFactory.getInvoker(paramObject, paramClass, paramURL);
  }
}
上一篇 下一篇

猜你喜欢

热点阅读