1. 修改默認的HttpInvokerRequestExecutor
<!-- 修改默認配置 -->
<bean id="httpInvokerRequestExecutor" class="org.springframework.remoting.httpinvoker.HttpComponentsHttpInvokerRequestExecutor">
<property name="connectTimeout" value="2000" />
<property name="readTimeout" value="5000" />
</bean>
<!-- 例子 -->
<bean id="orderService" class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">
<property name="serviceUrl" value="${mall_server}/${order_url}" />
<property name="serviceInterface" value="org.mall.modules.order.api.IOrderService" />
<property name="httpInvokerRequestExecutor"><ref bean="httpInvokerRequestExecutor" /></property>
</bean>
默認的HttpInvokerRequestExecutor不會設置超時時間,如果服務器這端處理慢岛马,會導致客戶體驗嚴重受到影響。
開啟長連接資料
http://backend.blog.163.com/blog/static/2022941262014029105618173/