// 源码中proxyFactory生成Invoker根据spi机制默认使用JavaassistRpcProxyFactory
Invoker<?> invoker = proxyFactory.getInvoker(ref, (Class) interfaceClass, registryURL.addParameterAndEncoded(Constants.EXPORT_KEY, url.toFullString()))
/**
* JavaassistRpcProxyFactory中获取Invoker动态生成了Wrapper对应类(Wrapper0,Wrapper+数字)和
* wrapper对象,Wrapper0类重点代理生成了invokeMethod方法
*
/
public <T> Invoker<T> getInvoker(T proxy, Class<T> type, URL url) {
final Wrapper wrapper = Wrapper.getWrapper(proxy.getClass().getName().indexOf('$') < 0 ? proxy.getClass() : type);
return new AbstractProxyInvoker<T>(proxy, type, url) {
@Override
protected Object doInvoke(T proxy, String methodName,
Class<?>[] parameterTypes,
Object[] arguments) throws Throwable {
return wrapper.invokeMethod(proxy, methodName, parameterTypes, arguments);
}
};
}
public Object invokeMethod(Object var1, String var2, Class[] var3, Object[] var4) throws InvocationTargetException {
VersionServiceImpl var5;
try {
var5 = (VersionServiceImpl)var1;
} catch (Throwable var8) {
throw new IllegalArgumentException(var8);
}
try {
if("autoLearn".equals(var2) && var3.length == 1) {
return var5.autoLearn((String)var4[0]);
}
if("sayHello".equals(var2) && var3.length == 1) {
return var5.sayHello((String)var4[0]);
}
} catch (Throwable var9) {
throw new InvocationTargetException(var9);
}
throw new NoSuchMethodException("Not found method \"" + var2 + "\" in class com.alibaba.dubbo.examples.version.impl.VersionServiceImpl.");
}