Class BlockingExecutorServiceConfig
- java.lang.Object
-
- com.pervasivecode.utils.concurrent.executors.BlockingExecutorServiceConfig
-
public abstract class BlockingExecutorServiceConfig extends Object
This object holds configuration information for aBlockingExecutorService
instance.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
BlockingExecutorServiceConfig.Builder
This object will build aBlockingExecutorServiceConfig
instance.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static BlockingExecutorServiceConfig.Builder
builder()
Create an object that will build aBlockingExecutorServiceConfig
instance.abstract CurrentNanosSource
currentNanosSource()
A time source with nanoseconds precision.abstract String
nameFormat()
The format to use to name worker threads.abstract int
numThreads()
The number of threads that should be created by the BlockingExecutorService for use in running submitted tasks.abstract int
queueSize()
The size of the task queue that should be created to hold pending tasks until they can be run by a worker thread.abstract MultistageStopwatch<BlockingExecutorService.Operation>
stopwatch()
AMultistageStopwatch
<
BlockingExecutorService.Operation
>
that will be used to track the amount of time that tasks spend in various parts of the BlockingExecutorService's lifecycle.
-
-
-
Method Detail
-
builder
public static BlockingExecutorServiceConfig.Builder builder()
Create an object that will build aBlockingExecutorServiceConfig
instance.- Returns:
- an empty config builder.
-
currentNanosSource
public abstract CurrentNanosSource currentNanosSource()
A time source with nanoseconds precision.- Returns:
- the time source.
-
numThreads
public abstract int numThreads()
The number of threads that should be created by the BlockingExecutorService for use in running submitted tasks.- Returns:
- the number of worker threads.
-
nameFormat
public abstract String nameFormat()
The format to use to name worker threads. This must contain a "%d" placeholder which will be replaced with the worker's number.- Returns:
- the format string.
-
queueSize
public abstract int queueSize()
The size of the task queue that should be created to hold pending tasks until they can be run by a worker thread. When this queue is full, calls toBlockingExecutorService.submit(java.util.concurrent.Callable<T>)
will block. When the queue is not full and theBlockingExecutorService.submit(java.util.concurrent.Callable<T>)
has not been shut down, calls toBlockingExecutorService.submit(java.util.concurrent.Callable<T>)
will succeed.- Returns:
- the size of the task queue to create.
-
stopwatch
public abstract MultistageStopwatch<BlockingExecutorService.Operation> stopwatch()
AMultistageStopwatch
<
BlockingExecutorService.Operation
>
that will be used to track the amount of time that tasks spend in various parts of the BlockingExecutorService's lifecycle.- Returns:
- The stopwatch that will track task lifecycle times.
-
-