Axis2 1.3 服务端TimeOut设置

google了一遍在官网上发现,在服务端设置TimeOut的类型有两种,一种是SOCKET TIME OUT,另外一个是CONNECTION TIME OUT,官网的设置是在axis2.xml设置:

Timeout Configuration

Two timeout instances exist in the transport level, Socket timeout and Connection timeout. These can be configured either at deployment or run time. If configuring at deployment time, the user has to add the following lines in axis2.xml.

For Socket timeout:

<parameter name="SO_TIMEOUT">some_integer_value</parameter>
For Connection timeout:

<parameter name="CONNECTION_TIMEOUT">some_integer_value</parameter>
客户端的TimeOut设置如下:
For runtime configuration, it can be set as follows within the client stub:
...
Options options = new Options();
options.setProperty(HTTPConstants.SO_TIMEOUT, new Integer(timeOutInMilliSeconds));
options.setProperty(HTTPConstants.CONNECTION_TIMEOUT, new Integer(timeOutInMilliSeconds));

// or
options.setTimeOutInMilliSeconds(timeOutInMilliSeconds);



   查了一遍也没见如果没有axis2.xml的话怎么设置?死马当活马医,试一下在服务的services.xml里做配置,把官网上在axis2.xml的参数COPY到services.xml,在服务端的代码的加上一个延迟的线程,用soapui模拟客户端测试了一下,SO_TIMEOUT的参数设置是没问题的。
   既然在服务端设置了相关的TIME OUT,服务端业务逻辑处理上就得考虑如果业务没有在规定时间内完成,是否需要做回滚。否则就会造成业务不一致的情况,特别是写入类的服务,更加需要注意此类参数的设置对服务端业务事务处理的影响。

猜你喜欢

转载自jandytom.iteye.com/blog/1848085
今日推荐