servicecomb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "bismy" <bi...@qq.com>
Subject Re: [Discussion]Improve metrics health checker register mode
Date Mon, 05 Mar 2018 00:43:04 GMT
spring injection or SPI is preferred, as have done in other modules 


------------------ Original ------------------
From: Jimin Wu <wujimin@apache.org>
Date: Tue,Jan 9,2018 10:03 AM
To: dev <dev@servicecomb.apache.org>
Subject: Re: [Discussion]Improve metrics health checker register mode





On 2018-01-08 15:29, Willem Jiang <willem.jiang@gmail.com> wrote: 
> 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, 郑扬勇 <yangyong.zheng@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
> 

infact, spring need to write component-scan, otherwise got nothing.

and in our old production, we faced this slow scan problem many times.
Mime
  • Unnamed multipart/alternative (inline, 8-Bit, 0 bytes)
View raw message