disconf源码解读
disconf主要分为三个项目:
1-disconf.core主要是提供助手类http的resful重试等等,zkwather封装,加强了重试机制,做的东西很薄。
2-disconf.client强依赖spring,提供了扫包,自定义annotation的解析装配,切面逻辑处理aspectj,获取远端配置,并落地做的东西比较多依赖也很多。
3-disconf.web是后台管理的web应用,springmvcrestfulapi实现,前后端分离的开发模式,提供登录,后台管理的功能,业务的东西多一点,可能因为开源的原因,好多有些小功能上的bug,并没有提供权限管理的功能。
问题:privateMap<String,DisconfCenterFile>confFileMap=newHashMap<String,DisconfCenterFile>();
内部实现是一个hashMap
"main"prio=5tid=0x00007fa423805800nid=0x1703runnable[0x0000700000219000]
java.lang.Thread.State:RUNNABLE
atjava.util.HashMap.addEntry(HashMap.java:884)
atjava.util.HashMap.put(HashMap.java:505)
atcom.baidu.disconf.client.common.model.DisconfCenterFile.getKV(DisconfCenterFile.java:134)
atcom.baidu.disconf.client.usertools.impl.DisconfDataGetterDefaultImpl.getByFile(DisconfDataGetterDefaultImpl.java:28)
atcom.baidu.disconf.client.usertools.DisconfDataGetter.getByFile(DisconfDataGetter.java:22)
atcom.example.disconf.demo.task.DisconfDemoTask$1.run(DisconfDemoTask.java:80)
atjava.util.concurrent.ThreadPoolExecutor$CallerRunsPolicy.rejectedExecution(ThreadPoolExecutor.java:2025)
atjava.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:821)
atjava.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1372)
atcom.example.disconf.demo.task.DisconfDemoTask.run(DisconfDemoTask.java:77)
atcom.example.disconf.demo.DisconfDemoMain.main(DisconfDemoMain.java:36)
aspctj
"main"prio=5tid=0x00007fd6ac007000nid=0x1703runnable[0x0000700000219000]
java.lang.Thread.State:RUNNABLE
atjava.lang.Class.forName0(NativeMethod)
atjava.lang.Class.forName(Class.java:274)
atorg.aspectj.weaver.reflect.Java15AnnotationFinder.getAnnotationFromMember(Java15AnnotationFinder.java:100)
atorg.aspectj.weaver.reflect.ReflectionVar.getBindingAtJoinPoint(ReflectionVar.java:162)
atorg.aspectj.weaver.reflect.ShadowMatchImpl.getPointcutParameters(ShadowMatchImpl.java:108)
atorg.aspectj.weaver.reflect.ShadowMatchImpl.matchesJoinPoint(ShadowMatchImpl.java:88)
atorg.springframework.aop.aspectj.AspectJExpressionPointcut.matches(AspectJExpressionPointcut.java:336)
atorg.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:167)
atorg.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
atorg.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
atorg.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:653)
atcom.example.disconf.demo.config.CodeConfig$$EnhancerBySpringCGLIB$$2495de40.getCodeError(<generated>)
atcom.example.disconf.demo.task.DisconfDemoTask.run(DisconfDemoTask.java:71)
atcom.example.disconf.demo.DisconfDemoMain.main(DisconfDemoMain.java:36)
java.lang.Thread.State:RUNNABLE
atsun.reflect.Reflection.getCallerClass(NativeMethod)
atjava.lang.Class.getDeclaredFields(Class.java:1810)
atcom.baidu.disconf.client.store.aspect.DisconfAspectJ.decideAccess(DisconfAspectJ.java:60)
atsun.reflect.GeneratedMethodAccessor5.invoke(UnknownSource)
atsun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
atjava.lang.reflect.Method.invoke(Method.java:606)
atorg.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:621)
atorg.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:610)
atorg.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:68)
atorg.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:168)
atorg.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
atorg.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
atorg.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:653)
atcom.example.disconf.demo.config.JedisConfig$$EnhancerBySpringCGLIB$$ce8fc02a.getPort(<generated>)
atcom.example.disconf.demo.task.DisconfDemoTask.run(DisconfDemoTask.java:70)
atcom.example.disconf.demo.DisconfDemoMain.main(DisconfDemoMain.java:36)
DISCCONF本身代码写的很糟糕,使用过程中经常的发生问题,不推荐使用。