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:
parent
ca05698e16
commit
78db34251a
@ -373,10 +373,10 @@ public static class CallerRunsPolicy implements RejectedExecutionHandler {
|
|||||||
ThreadFactory threadFactory = new ThreadFactoryBuilder()
|
ThreadFactory threadFactory = new ThreadFactoryBuilder()
|
||||||
.setNameFormat(threadNamePrefix + "-%d")
|
.setNameFormat(threadNamePrefix + "-%d")
|
||||||
.setDaemon(true).build();
|
.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
|
```java
|
||||||
import java.util.concurrent.Executors;
|
import java.util.concurrent.Executors;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user