spring-boot - Hystrix 在调用 fallback 后不会终止线程
问题描述
我正在使用 Chaos Monkey Spring Boot 测试一个假装客户端的缓慢响应。回退被调用并返回响应,但方法执行继续。
logger.info("Get the value from the organization ms {}",Thread.currentThread().getName());
organizationDTO = organizationRemoteData.getRemoteOrgData(organizationId); // 1
logger.info("saving data in cache {} by {}", organizationDTO,Thread.currentThread().getName());
// saving data in redis
cacheOrganizationObject(organizationDTO);
return organizationDTO;
第 1 行失败并调用了回退,但我仍然在日志中看到“将数据保存在缓存中”。此行为使应用程序不一致。有什么解决方法吗?
日志:
Get the value from the organization ms hystrix-organizationThreadPool-1
calling fallback method to get the organization data for id 1
saving data in cache OrganizationDTO [] by hystrix-organizationThreadPool-1
解决方案
推荐阅读
- algorithm - 如何在循环缓冲区中从头到尾迭代而不分支
- java - 错误:多次找到项目字符串
- c++ - 获取执行时间而不考虑未安排的时间
- php - Laravel preg_match uri 验证器
- php - Laravel 5.8 资产 url 在 localhost 和服务器中的工作方式不同
- node.js - 在 node.js 中将请求正文作为 XML 字符串发布
- node.js - Zipkin (Opencensus) - 2 个名称相同而不是不同的 Span
- pyspark - 如何将pyspark数据帧拆分为多个相同记录数的数据帧
- objective-c - 我可以直接在照片应用中打开 PHAsset 吗?
- python - 我想让程序说明用户输入的项目是否不在 Sandwhich 订单列表中,说明我们没有库存