Solution

Use the High-speed Service Framework (HSF) tags methodSpecials and clientTimeout to configure the timeout period.

  • methodSpecials: sets the timeout period (unit: ms) for a single method.
  • clientTimeout: sets the general timeout period (unit: ms) for all methods in the interface.

The timeout period settings are sorted in descending order of priority as follows:

methodSpecials for the consumer > clientTimeout for the consumer > methodSpecials for the provider > clientTimeout for the provider

An example of the consumer tag settings is as follows:

<hsf:consumer id="service" interface="com.taobao.edas.service.SimpleService"
version="1.1.0" group="test1" clientTimeout="3000"
target="10.1.6.57:12200? _TIMEOUT=1000" maxWaitTimeForCsAddress="5000">
<hsf:methodSpecials>
    <hsf:methodSpecial name="sum" timeout="2000" ></hsf:methodSpecial>
</hsf:methodSpecials>
</hsf:consumer>