国产片侵犯亲女视频播放_亚洲精品二区_在线免费国产视频_欧美精品一区二区三区在线_少妇久久久_在线观看av不卡

服務(wù)器之家:專注于服務(wù)器技術(shù)及軟件下載分享
分類(lèi)導(dǎo)航

PHP教程|ASP.NET教程|Java教程|ASP教程|編程技術(shù)|正則表達(dá)式|C/C++|IOS|C#|Swift|Android|VB|R語(yǔ)言|JavaScript|易語(yǔ)言|vb.net|

服務(wù)器之家 - 編程語(yǔ)言 - Java教程 - SpringCloud重試機(jī)制配置詳解

SpringCloud重試機(jī)制配置詳解

2021-04-20 14:34張建斌 Java教程

本篇文章主要介紹了SpringCloud重試機(jī)制配置詳解,小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧

首先聲明一點(diǎn),這里的重試并不是報(bào)錯(cuò)以后的重試,而是負(fù)載均衡客戶端發(fā)現(xiàn)遠(yuǎn)程請(qǐng)求實(shí)例不可到達(dá)后,去重試其他實(shí)例。

SpringCloud重試機(jī)制配置詳解

?
1
2
3
4
5
6
7
8
@bean
@loadbalanced
resttemplate resttemplate() {
  httpcomponentsclienthttprequestfactory httprequestfactory = new httpcomponentsclienthttprequestfactory();
  httprequestfactory.setreadtimeout(5000);
  httprequestfactory.setconnecttimeout(5000);
  return new resttemplate(httprequestfactory);
}

SpringCloud重試機(jī)制配置詳解

feign重試機(jī)制 

feign默認(rèn)是通過(guò)自己包下的retryer進(jìn)行重試配置,默認(rèn)是5次

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package feign;
import static java.util.concurrent.timeunit.seconds;
 
/**
 * cloned for each invocation to {@link client#execute(request, feign.request.options)}.
 * implementations may keep state to determine if retry operations should continue or not.
 */
public interface retryer extends cloneable {
 
 /**
  * if retry is permitted, return (possibly after sleeping). otherwise propagate the exception.
  */
 void continueorpropagate(retryableexception e);
 
 retryer clone();
 
 public static class default implements retryer {
 
  private final int maxattempts;
  private final long period;
  private final long maxperiod;
  int attempt;
  long sleptformillis;
 
  public default() {
   this(100, seconds.tomillis(1), 5);
  }
 
  public default(long period, long maxperiod, int maxattempts) {
   this.period = period;
   this.maxperiod = maxperiod;
   this.maxattempts = maxattempts;
   this.attempt = 1;
  }

feign取消重試

?
1
2
3
4
@bean
  retryer feignretryer() {
    return retryer.never_retry;
  }

feign請(qǐng)求超時(shí)設(shè)置

?
1
2
3
4
5
6
7
@bean
request.options requestoptions(configurableenvironment env){
  int ribbonreadtimeout = env.getproperty("ribbon.readtimeout", int.class, 6000);
  int ribbonconnectiontimeout = env.getproperty("ribbon.connecttimeout", int.class, 3000);
 
  return new request.options(ribbonconnectiontimeout, ribbonreadtimeout);
}

以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持服務(wù)器之家。

原文鏈接:https://www.cnblogs.com/zhangjianbin/p/7228606.html

延伸 · 閱讀

精彩推薦
主站蜘蛛池模板: 欧美透逼 | 日韩精品极品视频在线观看免费 | 成av在线 | 欧美成人激情 | 亚洲视频在线免费观看 | 三级成人在线 | 女人久久久久 | 日韩欧美一区二区在线观看视频 | 久久久精品电影 | 欧美精品1 | 国产黄色av | 精品视频在线免费观看 | 精品在线看 | 亚洲国产精品久久 | 91视频.com | 欧美一级二级视频 | 9色av| 中文久久精品 | 欧美一级特黄aaaaaaa在线观看 | 中文字幕av一区二区三区 | 久久久激情视频 | 亚洲一区在线日韩在线深爱 | 综合婷婷 | 日日爱999| 午夜视频福利在线观看 | 婷婷久久五月天 | 国产在线视频一区二区 | 日韩欧美在线观看 | 成人黄网视频在线观看 | 久久国产精品无码网站 | 1区2区在线观看 | 国产精品一区不卡 | 日本不卡免费一区二区三区综合久久 | 欧美成人精品一区二区 | 亚洲视频一区二区三区 | 欧美一区二区在线播放 | 黄色片网站在线免费观看 | 亚洲社区在线 | 在线国产一区 | 麻豆一区二区三区 | 精品无码久久久久国产 |