You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@servicecomb.apache.org by 郑扬勇 <ya...@qq.com> on 2018/01/09 01:47:30 UTC
回复: [Discussion]Improve metrics health checker register mode
Ok , sounds good ,I will do this way~
------------------ 原始邮件 ------------------
发件人: "willem.jiang";<wi...@gmail.com>;
发送时间: 2018年1月8日(星期一) 下午3:29
收件人: "dev"<de...@servicecomb.apache.org>;
主题: Re: [Discussion]Improve metrics health checker register mode
The annotation way just a common use case in Spring. I don't think it will
slow down your application startup processing too much.
You don't need to do the work yourself, Spring support it out of box.
we could add @Service to specify the instance of HealthChecker.
We could use the @Autowire to inject the instance to registry without
changing anything.
Willem Jiang
Blog: http://willemjiang.blogspot.com (English)
http://jnn.iteye.com (Chinese)
Twitter: willemjiang
Weibo: 姜宁willem
On Mon, Jan 8, 2018 at 3:15 PM, 郑扬勇 <ya...@qq.com> wrote:
> Hi everyone:
> Current we support user use "HealthCheckerManager.register(HealthChecker
> checker)" to register his own health checker,and I think we may make this
> registration more easier.
> 1. The first way is implement an Annotation like @Health,like this :
>
> @Health
> public class CustomHealthCheckerAnnotation implements
> HealthChecker {...}
>
> This way don't need any more config,but the disadvantage is that we
> need scan all package find out those checkers like :
>
> ClassPathScanningCandidateComponentProvider scanner = new
> ClassPathScanningCandidateComponentProvider(false);
> scanner.addIncludeFilter(new AnnotationTypeFilter(Health.
> class));
> for (BeanDefinition definition : scanner.findCandidateComponents("./"))
> { ...}
>
> this stage may slow.
>
> 2.The second way is use java SPI, use declare checkers in
> META-INF/services/xxx,It's more fast but need config.
>
> Any suggestion is welcome!
>
> Best Regards & Thanks!
> zhengyangyong