From 68151d950394cdb335657a4beb00562a7afc9cfe Mon Sep 17 00:00:00 2001 From: Jiabin Date: Sun, 5 Jan 2020 15:23:52 +0800 Subject: [PATCH 1/2] Fix wrong if statement in Redis.md --- docs/database/Redis/Redis.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/database/Redis/Redis.md b/docs/database/Redis/Redis.md index 02f4de14..b6ff963c 100644 --- a/docs/database/Redis/Redis.md +++ b/docs/database/Redis/Redis.md @@ -304,7 +304,7 @@ public Object getObjectInclNullById(Integer id) { // 从缓存中获取数据 Object cacheValue = cache.get(id); // 缓存为空 - if (cacheValue != null) { + if (cacheValue == null) { // 从数据库中获取 Object storageValue = storage.get(key); // 缓存空对象 @@ -367,4 +367,4 @@ public Object getObjectInclNullById(Integer id) { **Java工程师必备学习资源:** 一些Java工程师常用学习资源公众号后台回复关键字 **“1”** 即可免费无套路获取。 -![我的公众号](https://my-blog-to-use.oss-cn-beijing.aliyuncs.com/2019-6/167598cd2e17b8ec.png) \ No newline at end of file +![我的公众号](https://my-blog-to-use.oss-cn-beijing.aliyuncs.com/2019-6/167598cd2e17b8ec.png) From 51072ebdaa0684ab2d078b474082a172100666bf Mon Sep 17 00:00:00 2001 From: Jiabin Date: Sun, 5 Jan 2020 16:24:40 +0800 Subject: [PATCH 2/2] =?UTF-8?q?Fix=20typo=20in=20java=E7=BA=BF=E7=A8=8B?= =?UTF-8?q?=E6=B1=A0=E5=AD=A6=E4=B9=A0=E6=80=BB=E7=BB=93.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/java/Multithread/java线程池学习总结.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/java/Multithread/java线程池学习总结.md b/docs/java/Multithread/java线程池学习总结.md index 0732ef5e..bfbe99d4 100644 --- a/docs/java/Multithread/java线程池学习总结.md +++ b/docs/java/Multithread/java线程池学习总结.md @@ -652,9 +652,9 @@ Wed Nov 13 13:40:43 CST 2019::pool-1-thread-5 2. 当前线程池中有一个运行的线程后,将任务加入 `LinkedBlockingQueue` 3. 线程执行完当前的任务后,会在循环中反复从` LinkedBlockingQueue` 中获取任务来执行; -#### 5.2.3 为什么不推荐使用`FixedThreadPool`? +#### 5.2.3 为什么不推荐使用`SingleThreadExecutor`? -`SingleThreadExecutor` 使用无界队列 `LinkedBlockingQueue` 作为线程池的工作队列(队列的容量为 Intger.MAX_VALUE)。`SingleThreadExecuto`r 使用无界队列作为线程池的工作队列会对线程池带来的影响与 `FixedThreadPool` 相同。说简单点就是可能会导致 OOM, +`SingleThreadExecutor` 使用无界队列 `LinkedBlockingQueue` 作为线程池的工作队列(队列的容量为 Intger.MAX_VALUE)。`SingleThreadExecutor` 使用无界队列作为线程池的工作队列会对线程池带来的影响与 `FixedThreadPool` 相同。说简单点就是可能会导致 OOM, ### 5.3 CachedThreadPool 详解