欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

xfire 客户端超时设置不起作用 Java.net

程序员文章站 2022-06-11 10:22:08
...

代码如下
service = (T) new XFireProxyFactory().create(serviceModel, url);
       
int TIMEOUT = 10000;

HttpClientParams params = new HttpClientParams();
params
        .setParameter(HttpClientParams.USE_EXPECT_CONTINUE,
                Boolean.FALSE);

params.setParameter(HttpClientParams.CONNECTION_MANAGER_TIMEOUT,
        Long.parseLong(TIMEOUT+""));
params.setParameter(HttpClientParams.SO_TIMEOUT, TIMEOUT);

Client client = Client.getInstance(service);

client.setTimeout(TIMEOUT);
client.setProperty(CommonsHttpMessageSender.HTTP_CLIENT_PARAMS, params);
client.setProperty(CommonsHttpMessageSender.HTTP_TIMEOUT, TIMEOUT+"");
client.setProperty(CommonsHttpMessageSender.DISABLE_EXPECT_CONTINUE,
        "true");
client.setProperty(CommonsHttpMessageSender.DISABLE_KEEP_ALIVE, "true");

但是 超时不起作用

页面上仍然长时间的载入中 且控制台日志如下:

2011-01-24 15:55:11,361 INFO  [HttpMethodDirector.java:434] : I/O exception caught when processing request: Connection timed out
2011-01-24 15:55:11,362 INFO  [HttpMethodDirector.java:440] : Retrying request
2011-01-24 15:58:20,350 INFO  [HttpMethodDirector.java:434] : I/O exception caught when processing request: Connection timed out
2011-01-24 15:58:20,351 INFO  [HttpMethodDirector.java:440] : Retrying request
2011-01-24 16:01:29,338 INFO  [HttpMethodDirector.java:434] : I/O exception caught when processing request: Connection timed out
2011-01-24 16:01:29,339 INFO  [HttpMethodDirector.java:440] : Retrying request
2011-01-24 16:04:38,327 ERROR [HttpChannel.java:144] : java.net.ConnectException: Connection timed out
org.codehaus.xfire.XFireRuntimeException: Could not invoke service.. Nested exception is org.codehaus.xfire.fault.XFireFault: Couldn't send message.
org.codehaus.xfire.fault.XFireFault: Couldn't send message.


似乎隔三分钟 就去连接一下 第四次终于放弃了

  xfire 客户端超时设置不起作用
            
    
    
        Java.netxfire 客户端超时设置不起作用
            
    
    
        Java.net xfire 客户端超时设置不起作用
            
    
    
        Java.net

相关标签: Java .net