1
0
mirror of https://github.com/Snailclimb/JavaGuide synced 2025-06-16 18:10:13 +08:00

Update java-concurrent-questions-03.md

(cherry picked from commit b909162f1518108abddf0a07fea0277009a868e5)
This commit is contained in:
paigeman 2023-06-09 19:17:23 +08:00
parent ca05698e16
commit 78db34251a
No known key found for this signature in database
GPG Key ID: 5B81BFA20DA31317

View File

@ -373,10 +373,10 @@ public static class CallerRunsPolicy implements RejectedExecutionHandler {
ThreadFactory threadFactory = new ThreadFactoryBuilder()
.setNameFormat(threadNamePrefix + "-%d")
.setDaemon(true).build();
ExecutorService threadPool = new ThreadPoolExecutor(corePoolSize, maximumPoolSize, keepAliveTime, TimeUnit.MINUTES, workQueue, threadFactory)
ExecutorService threadPool = new ThreadPoolExecutor(corePoolSize, maximumPoolSize, keepAliveTime, TimeUnit.MINUTES, workQueue, threadFactory);
```
**2、自己实现 `ThreadFactor`。**
**2、自己实现 `ThreadFactory`。**
```java
import java.util.concurrent.Executors;