From 7e69818e7df7ab95f998845e7579053c83633361 Mon Sep 17 00:00:00 2001
From: yuanguangxin <274841922@qq.com>
Date: Thu, 4 Jun 2020 18:23:19 +0800
Subject: [PATCH] update
---
.idea/workspace.xml | 30 +++++++++++++++---------------
Rocket.md | 9 ++++++++-
2 files changed, 23 insertions(+), 16 deletions(-)
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index ab3d1c3..60d5fa7 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -261,14 +261,7 @@
-
-
-
- 1581704713975
-
-
-
- 1581704713975
+
1581705212871
@@ -606,7 +599,14 @@
1591254334745
-
+
+ 1591262493149
+
+
+
+ 1591262493149
+
+
@@ -691,16 +691,16 @@
-
+
-
-
+
+
-
+
@@ -747,11 +747,11 @@
-
+
-
+
diff --git a/Rocket.md b/Rocket.md
index 8ef6e5b..b5ec954 100644
--- a/Rocket.md
+++ b/Rocket.md
@@ -165,7 +165,7 @@ Read View就是事务进行快照读操作的时候生产的读视图,在该
### Next-Key Lock
-InnoDB 采用 Next-Key Lock 解决幻读问题。在`insert into test(xid) values (1), (3), (5), (8), (11);`后,由于xid上是有索引的,该算法总是会去锁住索引记录。现在,该索引可能被锁住的范围如下:(-∞, 1], (1, 3], (3, 5], (5, 8], (8, 11], (11, +∞)。Session A执行后会锁住的范围:(5, 8], (8, 11]。除了锁住8所在的范围,还会锁住下一个范围,所谓Next-Key。
+InnoDB 采用 Next-Key Lock 解决幻读问题。在`insert into test(xid) values (1), (3), (5), (8), (11);`后,由于xid上是有索引的,该算法总是会去锁住索引记录。现在,该索引可能被锁住的范围如下:(-∞, 1], (1, 3], (3, 5], (5, 8], (8, 11], (11, +∞)。Session A(`select * from test where id = 8 for update`)执行后会锁住的范围:(5, 8], (8, 11]。除了锁住8所在的范围,还会锁住下一个范围,所谓Next-Key。
### Mysql的逻辑结构
@@ -515,6 +515,13 @@ AQS有两个队列,同步对列和条件队列。同步队列依赖一个双
6. threadFactory:线程工厂,用于创建线程,一般用默认的即可。
7. handler:拒绝策略。当任务太多来不及处理,如何拒绝任务。
+### 线程池都有哪几种工作队列
+
+1. ArrayBlockingQueue:底层是数组,有界队列,如果我们要使用生产者-消费者模式,这是非常好的选择。
+2. LinkedBlockingQueue:底层是链表,可以当做无界和有界队列来使用,所以大家不要以为它就是无界队列。
+3. SynchronousQueue:本身不带有空间来存储任何元素,使用上可以选择公平模式和非公平模式。
+4. PriorityBlockingQueue:无界队列,基于数组,数据结构为二叉堆,数组第一个也是树的根节点总是最小值。
+
### 线程池的拒绝策略
1. ThreadPoolExecutor.AbortPolicy:丢弃任务并抛出RejectedExecutionException异常。