Spring Cloud-hystrix(六)
作用 防止 多个服务相互交互时某个服务运行缓慢导致调用方线程挂起,高并发情况下 导致挂起线太多 引起调用方的服务不可用 能够在服务发生故障或者通过断路器监控向调用方返回一个错误 而不是长时间的等待 Spring Cloud Hystrix 实现了线程隔离 断路器等功能 是基于开源框架Netflix 实现的 Hystrix具备服 务降级、 服务熔断、 线程和信号隔离、 请求缓存、 请求合并以及服务监控等强大功能 简单例子 1.Provier增加一个增对hystirx测试的Contorller @Controller public class HistryxTestServiceContorller { @Qualifier("eurekaRegistration") @Autowired private Registration registration; // 服务注册 @RequestMapping(value = "/histryxTest1") @ResponseBody public String histryxTest1(){ List<String> serverInfo = new ArrayList<String>(); serverInfo.add("ServiceId:"+registration.getServiceId()); serverInfo.add(