From 4e5f88d89d64a796e2cd4fcaccae4973a885db8f Mon Sep 17 00:00:00 2001 From: cxhello <49056040+cxhello@users.noreply.github.com> Date: Fri, 1 Sep 2023 11:31:03 +0800 Subject: [PATCH 1/2] Update delayqueue-source-code.md --- docs/java/collection/delayqueue-source-code.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/java/collection/delayqueue-source-code.md b/docs/java/collection/delayqueue-source-code.md index bf889490..17974044 100644 --- a/docs/java/collection/delayqueue-source-code.md +++ b/docs/java/collection/delayqueue-source-code.md @@ -115,7 +115,7 @@ Task 3 ## DelayQueue 源码解析 -这里以 JDK1.8 为例,分析一下 `LinkedList` 的底层核心源码。 +这里以 JDK1.8 为例,分析一下 `DelayQueue` 的底层核心源码。 `DelayQueue` 的类定义如下: @@ -126,7 +126,7 @@ public class DelayQueue extends AbstractQueue implements B } ``` -`DelayQueue` 实现了 `AbstractQueue` 类,继承了 `BlockingQueue` 接口。 +`DelayQueue` 继承了 `AbstractQueue` 类,实现了 `BlockingQueue` 接口。 ![DelayQueue类图](https://oss.javaguide.cn/github/javaguide/java/collection/delayqueue-class-diagram.png) @@ -356,4 +356,4 @@ public E peek() { - 《深入理解高并发编程:JDK核心技术》: - 一口气说出Java 6种延时队列的实现方法(面试官也得服): - 图解DelayQueue源码(java 8)——延时队列的小九九: - \ No newline at end of file + From d8819d365d3b9dc85720fc5f4768b82b3d53d363 Mon Sep 17 00:00:00 2001 From: cxhello <49056040+cxhello@users.noreply.github.com> Date: Fri, 1 Sep 2023 15:42:02 +0800 Subject: [PATCH 2/2] Update io-design-patterns.md --- docs/java/io/io-design-patterns.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/java/io/io-design-patterns.md b/docs/java/io/io-design-patterns.md index 1c14c056..a597bce1 100644 --- a/docs/java/io/io-design-patterns.md +++ b/docs/java/io/io-design-patterns.md @@ -215,7 +215,7 @@ static final class RunnableAdapter implements Callable { 工厂模式用于创建对象,NIO 中大量用到了工厂模式,比如 `Files` 类的 `newInputStream` 方法用于创建 `InputStream` 对象(静态工厂)、 `Paths` 类的 `get` 方法创建 `Path` 对象(静态工厂)、`ZipFileSystem` 类(`sun.nio`包下的类,属于 `java.nio` 相关的一些内部实现)的 `getPath` 的方法创建 `Path` 对象(简单工厂)。 ```java -InputStream is Files.newInputStream(Paths.get(generatorLogoPath)) +InputStream is = Files.newInputStream(Paths.get(generatorLogoPath)) ``` ## 观察者模式 @@ -318,4 +318,4 @@ class PollingWatchService - 装饰器模式:通过剖析 Java IO 类库源码学习装饰器模式:https://time.geekbang.org/column/article/204845 - sun.nio 包是什么,是 java 代码么? - RednaxelaFX https://www.zhihu.com/question/29237781/answer/43653953 - \ No newline at end of file +