Commit b1577e9d by 房斌

1优化超时问题

2版本加载判断
3停机组件加载判断
parent 37343ed9
package com.secoo.mall.dubbo.condition;
import com.secoo.mall.dubbo.monitor.config.ConfigCenter;
import org.apache.dubbo.common.logger.Logger;
import org.apache.dubbo.common.logger.LoggerFactory;
import org.springframework.boot.SpringBootVersion;
import org.springframework.context.annotation.Condition;
import org.springframework.context.annotation.ConditionContext;
import org.springframework.core.type.AnnotatedTypeMetadata;
public class SpringBootVersionJudgment implements Condition {
public static final Logger logger = LoggerFactory.getLogger(ConfigCenter.class);
@Override
public boolean matches(ConditionContext conditionContext, AnnotatedTypeMetadata annotatedTypeMetadata) {
String version=SpringBootVersion.getVersion();
logger.info("springboot version:"+version);
try {
String[] str = version.split("\\.");
if (str != null && str.length >= 2) {
if (Integer.valueOf(str[0]).intValue() >= 2) {
if (Integer.valueOf(str[1]).intValue() >= 3) {
return false;
}
}
}
}catch (Exception e){
logger.error("matrix-gracefulshutdown version judgement error",e);
}
return true;
}
}
package com.secoo.mall.dubbo.spring.boot.autoconfigure;
import org.springframework.context.annotation.Conditional;
import java.lang.annotation.*;
@Target({ ElementType.TYPE, ElementType.METHOD })
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Conditional(com.secoo.mall.dubbo.condition.SpringBootVersionJudgment.class)
public @interface SpringBootVersionJudgment {
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment