Add NoOpCircuitBreaker
Change-Id: I81cff81983ff099217825466b24a72bf63c37665
In this PR, I try to add a NoOpCircuitBreaker same as here HystrixCircuitBreaker.java. It enables user to disable CircuitBreaker but still use the metrics and Dashboard feature, which is needed for new users like me.
The general logic is as follows:
- Add a
CircuitBreakerDisabledsetting so user can disable circuit. Default value is false for backward compatibility. - If user config
CircuitBreakerDisabledas true,GetCircuitwill return aNoOpCircuitBreakerwith anoOpExecutorPool.
More infos can be find in comments.
The test coverage is 93.2% and I had test the logic in real code logic. The benchmark of original and NoOp circuit is nearly the same, benchmark of noOpExecutorPool is worse than original executorPool, I think it may because I always return a new buffered chan with 1 element in it.
Please help review the code, looking forward to hear advises from you. Thanks!
@afex Please help take a look at this PR? Thanks.