TarsJava
TarsJava copied to clipboard
callback逻辑疑问
TarsCodec.decodeCallbackArgs 方法中
public Object[] decodeCallbackArgs(TarsServantResponse response) throws ProtocolException {
byte[] data = response.getInputStream().read(new byte[]{}, 6, true);
TarsServantRequest request = response.getRequest();
TarsMethodInfo methodInfo = null;
Map<Method, TarsMethodInfo> map = AnalystManager.getInstance().getMethodMap(request.getApi());
for (Iterator<Map.Entry<Method, TarsMethodInfo>> it = map.entrySet().iterator(); it.hasNext(); ) {
Map.Entry<Method, TarsMethodInfo> entry = it.next();
if (entry.getKey().getName().equals(request.getFunctionName())) {
methodInfo = entry.getValue();
}
}
try {
return decodeCallbackArgs(data, response.getCharsetName(), methodInfo);
} catch (Exception e) {
throw new ProtocolException(e);
}
}
TarsMethodInfo 的获取为什么要注册容器中获取,并且只匹配了方法名,如果有同名方法,可能会有问题.