Hystrix调用回退后不终止线程

时间:2019-10-15 22:19:00

标签: spring-boot hystrix fallback spring-cloud-feign spring-boot-chaos-monkey

我正在使用混乱的猴子弹簧靴测试假装客户的慢响应。调用后备并返回响应,但方法执行继续。

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

0 个答案:

没有答案