欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

disconf源码解读

程序员文章站 2022-07-13 22:44:58
...
disconf 主要分为三个项目:
    1-disconf.core   主要是提供助手类http的resful 重试等等,zk wather封装,加强了重试机制,做的东西很薄。
   2-disconf.client  强依赖 spring,提供了 扫包,自定义annotation的解析装配,切面逻辑处理aspectj,获取远端配置,并落地  做的东西比较多  依赖也很多。
   3-disconf.web   是后台管理的web应用,spring mvc restful  api实现,前后端分离的开发模式,提供登录,后台管理的功能,业务的东西多一点,可能因为开源的原因,好多有些小功能上的bug,并没有提供权限管理的功能。


问题:private Map<String, DisconfCenterFile> confFileMap = new HashMap<String, DisconfCenterFile>();

内部实现是一个hashMap


"main" prio=5 tid=0x00007fa423805800 nid=0x1703 runnable [0x0000700000219000]
   java.lang.Thread.State: RUNNABLE
at java.util.HashMap.addEntry(HashMap.java:884)
at java.util.HashMap.put(HashMap.java:505)
at com.baidu.disconf.client.common.model.DisconfCenterFile.getKV(DisconfCenterFile.java:134)
at com.baidu.disconf.client.usertools.impl.DisconfDataGetterDefaultImpl.getByFile(DisconfDataGetterDefaultImpl.java:28)
at com.baidu.disconf.client.usertools.DisconfDataGetter.getByFile(DisconfDataGetter.java:22)
at com.example.disconf.demo.task.DisconfDemoTask$1.run(DisconfDemoTask.java:80)
at java.util.concurrent.ThreadPoolExecutor$CallerRunsPolicy.rejectedExecution(ThreadPoolExecutor.java:2025)
at java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:821)
at java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1372)
at com.example.disconf.demo.task.DisconfDemoTask.run(DisconfDemoTask.java:77)
at com.example.disconf.demo.DisconfDemoMain.main(DisconfDemoMain.java:36)



aspctj 
"main" prio=5 tid=0x00007fd6ac007000 nid=0x1703 runnable [0x0000700000219000]
   java.lang.Thread.State: RUNNABLE
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:274)
at org.aspectj.weaver.reflect.Java15AnnotationFinder.getAnnotationFromMember(Java15AnnotationFinder.java:100)
at org.aspectj.weaver.reflect.ReflectionVar.getBindingAtJoinPoint(ReflectionVar.java:162)
at org.aspectj.weaver.reflect.ShadowMatchImpl.getPointcutParameters(ShadowMatchImpl.java:108)
at org.aspectj.weaver.reflect.ShadowMatchImpl.matchesJoinPoint(ShadowMatchImpl.java:88)
at org.springframework.aop.aspectj.AspectJExpressionPointcut.matches(AspectJExpressionPointcut.java:336)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:167)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:653)
at com.example.disconf.demo.config.CodeConfig$$EnhancerBySpringCGLIB$$2495de40.getCodeError(<generated>)
at com.example.disconf.demo.task.DisconfDemoTask.run(DisconfDemoTask.java:71)
at com.example.disconf.demo.DisconfDemoMain.main(DisconfDemoMain.java:36)



java.lang.Thread.State: RUNNABLE
at sun.reflect.Reflection.getCallerClass(Native Method)
at java.lang.Class.getDeclaredFields(Class.java:1810)
at com.baidu.disconf.client.store.aspect.DisconfAspectJ.decideAccess(DisconfAspectJ.java:60)
at sun.reflect.GeneratedMethodAccessor5.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:621)
at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:610)
at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:68)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:168)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:653)
at com.example.disconf.demo.config.JedisConfig$$EnhancerBySpringCGLIB$$ce8fc02a.getPort(<generated>)
at com.example.disconf.demo.task.DisconfDemoTask.run(DisconfDemoTask.java:70)
at com.example.disconf.demo.DisconfDemoMain.main(DisconfDemoMain.java:36)

DISCCONF本身代码写的很糟糕,使用过程中经常的发生问题,不推荐使用。