摘要: 存储结构 threadLocal存储于Thread类上的ThreadLocalMap类型的threadLocals中。 从ThreadLocalMap的名字上可以看出其结构类似于HashMap,它也是使用key-value结构的Entry数组table来存储ThreadLocal和值。 但区别在于E 阅读全文
posted @ 2020-07-22 19:45 wuweishuo 阅读(641) 评论(0) 推荐(0) 编辑
摘要: @EnableZuulProxy和@EnableZuulServer @EnableZuulProxy和@EnableZuulServer通过实例化不同的Marker,走不同的AutoConfiguration。 @EnableZuulProxy所走的ZuulProxyAutoConfigurati 阅读全文
posted @ 2020-07-20 17:58 wuweishuo 阅读(289) 评论(0) 推荐(0) 编辑
摘要: @EnableTransactionManagement import了TransactionManagementConfigurationSelector,而TransactionManagementConfigurationSelector继承于AdviceModeImportSelector根 阅读全文
posted @ 2020-07-01 19:19 wuweishuo 阅读(302) 评论(0) 推荐(0) 编辑
摘要: TransactionDefinition——事务定义 定义事务属性,包括传播级别、隔离级别、名称、超时、只读等 TransactionStatus——事务状态 事务状态,包含事务对象(jdbc为DataSourceTransactionObject),是否新事务、是否新同步对象、是否只读、是否回滚 阅读全文
posted @ 2020-07-01 19:17 wuweishuo 阅读(242) 评论(0) 推荐(0) 编辑
摘要: @MapperScan配置在@Configuration注解的类上会导入MapperScannerRegistrar类。 而MapperScannerRegistrar实现了ImportBeanDefinitionRegistrar接口,可以向BeanDefinitionRegistry注册Bean 阅读全文
posted @ 2020-06-16 16:52 wuweishuo 阅读(1323) 评论(0) 推荐(0) 编辑
摘要: mapper的代理对象生成位于org.apache.ibatis.binding.MapperProxyFactory的newInstance方法,使用jdk的动态代理,代理的InvocationHandler为org.apache.ibatis.binding.MapperProxy。 调用代理对 阅读全文
posted @ 2020-06-16 14:47 wuweishuo 阅读(175) 评论(0) 推荐(0) 编辑
摘要: Mapper的注册入口在Configuration的addMapper方法中,其会调用MapperRegistry的addMapper方法。 Mapper的注册过程分为两个步骤: 1.创建MapperProxyFactory,将其与mapper的class进行映射 2.解析mapper对应xml文件 阅读全文
posted @ 2020-06-16 14:39 wuweishuo 阅读(690) 评论(0) 推荐(0) 编辑
摘要: Configuration 主要字段 Environment:配置DataSource和TransactionFactory ObjectFactory:bean工厂 MapperRegistry:Mapper的注册器,用Map存放class与MapperProxyFactory的映射 Interc 阅读全文
posted @ 2020-06-10 18:00 wuweishuo 阅读(336) 评论(0) 推荐(0) 编辑
摘要: IRule——负载均衡规则 1.RounRobinRule:轮询负载均衡,通过累加取余获取服务,默认规则 2.RandomRule:随机负载均衡 3.WeightedResponseTimeRule:根据响应时间进行加权轮询 4.RetryRule:在一定的时间内使用指定的规则获取可用的服务 5.B 阅读全文
posted @ 2020-06-09 11:15 wuweishuo 阅读(456) 评论(0) 推荐(0) 编辑
摘要: 一次对ThreadLocal的学习引发的思考 ThreadLocal对Entry的引用是弱引用,于是联想到四种引用的生命周期。 1. 强引用,不会进行垃圾回收 2. 软引用,JVM内存不够,进行回收 3. 弱引用,下次GC,直接进行回收 4. 虚引用,不会对GC产生任何影响,结合ReferenceQ 阅读全文
posted @ 2019-09-30 16:06 wuweishuo 阅读(665) 评论(0) 推荐(0) 编辑