hashMap 原理,这一篇结合源码,解析得比较透彻。
hashMap 不是线程安全
计算hash 值传入对象的hashcode,如果两个对象的hashcode 相同,会出现覆盖。
从这个里面可以知道,java 对比 对象是否相等的 equel 操作实际上是 对比hashcode
int hash = hash(key.hashCode());
85 static int hash(int h) {
86 h ^= (h >>> 20) ^ (h >>> 12);
87 return h ^ (h >>> 7) ^ (h >>> 4);
88 }
89
90 // 返回索引值
91 // h & (length-1)保证返回值的小于length
92 static int indexFor(int h, int length) {
93 return h & (length-1);
94 }
hashTable 原理介绍,线程安全
spring 的事务处理
写完接口 装个 jmeter 压测一下
Java gc 简析
如何理解这句log
2019-12-03T14:43:39.303+0800: 56545.152:
[GC (Allocation Failure) 2019-12-03T14:43:39.303+0800: 56545.152: [ParNew: 850892K->8041K(943744K), 0.0145080 secs] 912909K->70061K(1992320K), 0.0147129 secs] [Times: user=0.08 sys=0.01, real=0.01 secs]
Feign 简述
feign是声明式的web service客户端,它让微服务之间的调用变得更简单了,类似controller调用service。Spring Cloud集成了Ribbon和Eureka,可在使用Feign时提供负载均衡的http客户端。
==》 https://www.jianshu.com/p/8bca50cb11d8
https://www.jianshu.com/p/3d597e9d2d67/
round-robin 循环调度
j = (j + 1) mod n;
网友评论