* [ ] 線程池隔離
* [ ] Hystrix自動實現依賴隔離
熔斷的配置:
在需要進行熔斷配置的方法上加上Hystrix的注解
```
@HystrixCommand(commandProperties = {
@HystrixProperty(name = "circuitBreaker.enabled" , value = "true"), //設置熔斷
@HystrixProperty(name = "circuitBreaker.requestVolumeThreshold" , value = "10"),
@HystrixProperty(name = "circuitBreaker.sleepWindowInMilliseconds" , value = "1000"),
@HystrixProperty(name = "circuitBreaker.errorThresholdPercentage" , value = "60")
})
```
* Circuit Breaker : 斷路器
[斷路器詳解,馬丁](https://martinfowler.com/bliki/CircuitBreaker.html)
斷路器是將受保護的對象封裝在可以監控故障的斷路對象里面,當故障達到一定的值,將會引發跳閘,斷路器對象返回錯誤
* [ ] 圖解(斷路器模式狀態機):
:-: 
* circuitBreaker.sleepWindowInMilliseconds:時間窗口
當斷路器打開,對主邏輯進行熔斷之后,Hystrix會開啟一個休眠時間窗口,將降級邏輯臨時提升為主邏輯,當休眠時間到期,斷路器將進入半開狀態,釋放一次請求到原來的主邏輯上,如果此次請求正常返回,那么斷路器將繼續閉合,主邏輯恢復,如果此次請求依然失敗,斷路器進入打開狀態,休眠時間窗繼續計時。
* circuitBreaker.requestVolumeThreshold : 設置在滾動窗口中斷路器的最小請求數
* circuitBreaker.errorThresholdPercentage : 斷路器打開的錯誤百分比條件
在配置文件中統一配置:
```
hystrix:
command:
default:
execution:
isolation:
thread:
timeoutInMilliseconds: 3000
getProductInfoList:
execution:
isolation:
thread:
timeoutInMilliseconds: 800
```