当我们调用“R response = proxy.CallAPISync(request);”时,为什么没有执行构造函数RegisterProxy()? ?
public class SoaCaller {
private static RegisterProxy proxy = new RegisterProxy(); ;
public static <T, R> R CallAPISyn(T request){
R response = proxy.CallAPISync(request);
return response;
}
}
public class RegisterProxy {
private static HashMap<String, BaseSoaImplement> cache = new HashMap<>();
public RegisterProxy(){
try {
cache.put(GetHotelStaticInfoRequestType.class.getName(), new GetHotelStaticInfoImpl());
}
catch (Exception ex){
ExceptionUtils.getStackTrace(ex));
}
}
答案 0 :(得分:1)
new RegisterProxy();
时, SoaCaller
仅 运行。
这可能比调用CallAPISyn