schedule定时任务调整,fallback熔断机制改为factory模式

yun-zuoyi
alwaysfrin 6 years ago
parent 1c7d601922
commit 5951d7fad8

@ -1,5 +1,8 @@
package cn.estsh.i3plus.pojo.base.bean;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* @Description : fallback
* @Reference :
@ -8,9 +11,27 @@ package cn.estsh.i3plus.pojo.base.bean;
* @Modify:
**/
public class BaseFallBackBean {
private static final Logger LOGGER = LoggerFactory.getLogger(BaseFallBackBean.class);
// LOGGER.error("【微服出错,熔断】{}",cause.getMessage());
// LOGGER.error("【微服出错,熔断】{}",cause.getLocalizedMessage());
// LOGGER.error("【微服出错,熔断】{}",cause.getCause());
// cause.printStackTrace();
public BaseResultBean makeBaseFallBack(Throwable cause){
LOGGER.error("【熔断信息】{}",cause.getMessage());
LOGGER.error("【熔断原因】{}",cause.getCause());
return makeBaseFallBack("【微服熔断】服务暂停,请稍后再试。",cause);
}
public BaseResultBean makeBaseFallBack(String msg,Throwable cause){
LOGGER.error("【熔断信息】{}",cause.getMessage());
LOGGER.error("【熔断原因】{}",cause.getCause());
return BaseResultBean.buildBaseResultBean(false,cause.getMessage() + ",信息:" + msg);
}
public BaseResultBean makeBaseFallBack(){
return makeBaseFallBack("服务暂停");
return makeBaseFallBack("【微服熔断】服务暂停,请稍后再试。");
}
public BaseResultBean makeBaseFallBack(String msg){

Loading…
Cancel
Save