当验证团队通过断开 Web 服务服务器来对应用程序施加压力时,即使使用下一个代码,我的 Axis2 服务客户端 ConnectionTimeout 持续太长 [大约 60 秒]:
serviceClient.getOptions().setProperty(HTTPConstants.CONNECTION_TIMEOUT, 1000);
serviceClient.getOptions().setProperty(HTTPConstants.SO_TIMEOUT, 5000);
我的 Axis2 组件版本是:
axis2: 1.5
axis2-transport-http: 1.5.4
axis2-transport-local: 1.5.4
wsdl4j [if useful]: 1.6.2
不再使用了吗?
提前致谢,亲切的问候。
最佳答案
最后我发现这个问题的错误在于我放置 CACHED_HTTP_CLIENT 参数的位置:
不正确代码:
serviceClient.getOptions().setProperty(HTTPConstants.CACHED_HTTP_CLIENT, httpClient);
正确代码:
ConfigurationContext axisContext;
try {
axisContext = ConfigurationContextFactory.createDefaultConfigurationContext();
} catch (Exception e) {
throw new AxisFault(e.getMessage());
}
axisContext.setProperty(HTTPConstants.CACHED_HTTP_CLIENT, httpClient);
stub = new MyStub(axisContext, url);
关于java - 轴2版本1.5.4 连接超时似乎不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18625708/