WSIFOperation - 同步和异步超时引用
当您使用 Java™ 消息服务 (JMS) 的 Web Services Invocation Framework (WSIF) 时,您可以设置同步和异步操作的超时。
wsif.properties 文件中定义了这些超时的缺省值:
# maximum number of milliseconds to wait for a response to a synchronous request.
# Default value if not defined is to wait forever.
wsif.syncrequest.timeout=10000
# maximum number of seconds to wait for a response to an async request.
# if not defined or invalid defaults to no timeout
wsif.asyncrequest.timeout=60
如果您使用这些缺省值,同步请求(例如 WSIFOperation 接口 executeRequestResponseOperation 方法调用)将在 10 秒后超时,而异步请求(例如 WSIFOperation 接口 executeRequestResponseAsync 方法调用)将在 60 秒后超时。
注:
处理这些超时值的代码使用毫秒作为其时间单位。WSIFProperties 类 getAsyncTimeout 方法将 wsif.asyncrequest.timeout 值乘以 1000,以将值从秒转换为毫秒。
通过编写 WSDL 扩展以在操作请求上设置带有 <jms:property> 和 <jms:propertyValue> WSDL 元素的 JMS 属性,您可以覆盖给定请求的这些缺省值。将属性名设为来自 WSIF 属性文件的超时名称。
下列示例设置同步请求在 2 分钟(120 秒)后超时:
<jms:propertyValue name=“wsif.syncrequest.timeout” type=“xsd:string” value=“120000”/>
并且下列示例禁用异步超时(值为零意味这永远等待):<jms:propertyValue name=“wsif.asyncrequest.timeout” type=“xsd:string” value=“0”/>
当异步超时到期,不会通知任何等待响应的侦听器或消息数据库。异步超时仅用于通知相关服务可以删除存储的 WSIFOperation。关于相关服务的更多信息,请参阅 WSIFOperation - 异步交互作用引用。