public final class MoreExecutors extends Object
| Modifier and Type | Class and Description |
|---|---|
static interface |
MoreExecutors.ThreadPoolExecutorBuilder |
| Modifier and Type | Method and Description |
|---|---|
static MoreExecutors.ThreadPoolExecutorBuilder |
threadPoolDaemonExecutorBuilder(String namePrefix) |
static MoreExecutors.ThreadPoolExecutorBuilder |
threadPoolNonDaemonExecutorBuilder(String namePrefix)
An opinionated builder for a new executor.
|
public static MoreExecutors.ThreadPoolExecutorBuilder threadPoolNonDaemonExecutorBuilder(String namePrefix)
The only required parameter is a name for the thread factory, and by default the thread pool is daemon.
<p>
ExecutorService service = Executors2.threadPoolNonDaemonExecutorBuilder("my-pool")
.setMaxSize(100) // now we have 100 max threads
.setBlockWhenFull(true) // will block once 100 tasks are being worked on
.build();
The name of the threads will be of the form "{namePrefix}-N" where N is an integer.
public static MoreExecutors.ThreadPoolExecutorBuilder threadPoolDaemonExecutorBuilder(String namePrefix)
Copyright © 2020. All rights reserved.