Xinda's Blog

永远在路上,归来仍年少

Java线程中断的本质

从RocketMQ的一个PR说起 #5515 前几天看RocketMQPR发现一个有意思的内容是捕获到的线程中断异常不应该被忽略. 原逻辑 1 2 3 4 try { scheduledExecutorService.awaitTermination(5000, TimeUnit.MILLISECONDS); } catch (Interrupted...

多个单独二级索引情况下的MySQL更新死锁

环境 5.7.19-log REPEATABLE-READ 表结构 1 2 3 4 5 6 7 8 9 CREATE TABLE "dead_lock" ( "id" bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键', "o1" int(11) DEFAULT NULL, "f1" i...

二叉树的几种遍历方式

递归 前序遍历 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 /** * Definition for a binary tree node. * public class TreeNode { * ...

JDK与CGLIB动态代理

JDK动态代理 实现InovactionHandler接口 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 import java.lang.reflect.InvocationHandler; import java.lang.reflect.Method; /** * 耗时统...

Java对象的内存布局

工具 JOL(Java Object Layout) 1 2 3 4 5 <dependency> <groupId>org.openjdk.jol</groupId> <artifactId>jol-core</artifactId> <version>0.9</version>...

Spring Framework运行原理

IOC的整体流程 AOP的整体流程

OpenFeign与Hystrix整合运行流程

依赖版本 1 2 3 4 5 6 7 8 9 10 11 <dependencyManagement> <dependencies> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId...

Ribbon流程细节

依赖版本 1 2 3 4 5 6 7 8 9 10 11 <dependencyManagement> <dependencies> <dependency> <groupId>org.springframework.cloud</groupId> <artifac...

Eureka启动与注册同步流程

Eureka启动流程 Eureka注册流程 Eureka服务拉取流程 Eureka发送心跳 仅仅是更新了一下lastUpdateTimestamp Eureka服务下线 bug 实际过期时间是duration * 2, 并不是设置的或默认的90s, 是180s 时间补偿机制 在定时检查实例存活状态的时候会进行时间补偿, 以防止时...

OpenFeign启动以及调用流程

依赖版本 1 2 3 4 5 6 7 8 9 10 11 <dependencyManagement> <dependencies> <dependency> <groupId>org.springframework.cloud</groupId> <artifa...