public static class RestClient.Executor
extends java.lang.Object
The number of threads in the pool will be expanded up to threadsMax and down to
thredsMin based on the size of of the queue. Up to queueMax tasks
can occupy the queue before caller will start to be blocked having to wait for queue space to
clear up.
You can completely disable asynchronous execution by setting threadsMax to zero.
That will ensure that tasks will always execute synchronously in the calling thread and will
be completed by the time submit returns.
| Modifier and Type | Field and Description |
|---|---|
protected int |
queueMax |
protected int |
threadsMax
The thread pool will by dynamically expanded up to this max number of worker threads as the queue length grows.
|
protected int |
threadsMin
The thread pool will be dynamically contracted to this minimum number of worker threads as the queue length shrinks.
|
| Constructor and Description |
|---|
Executor() |
| Modifier and Type | Method and Description |
|---|---|
int |
getQueueMax() |
int |
getThreadsMax() |
int |
getThreadsMin() |
java.util.concurrent.Future |
submit(java.lang.Runnable task) |
java.util.concurrent.RunnableFuture |
submit(java.util.concurrent.RunnableFuture task)
Puts
task into the queue to be run unless threadsMax is less than one in which case
the task is immediately run synchronously in stead of asynchronously. |
RestClient.Executor |
withQueueMax(int queueMax) |
RestClient.Executor |
withThreadsMax(int threadsMax) |
RestClient.Executor |
withThreadsMin(int threadsMin) |
protected int threadsMin
protected int threadsMax
If this number is less than 1, then tasks will be executed synchronously in the calling thread, not asynchronously.
protected int queueMax
public java.util.concurrent.Future submit(java.lang.Runnable task)
public java.util.concurrent.RunnableFuture submit(java.util.concurrent.RunnableFuture task)
task into the queue to be run unless threadsMax is less than one in which case
the task is immediately run synchronously in stead of asynchronously.task - the task to runpublic int getThreadsMin()
public RestClient.Executor withThreadsMin(int threadsMin)
public int getThreadsMax()
public RestClient.Executor withThreadsMax(int threadsMax)
public int getQueueMax()
public RestClient.Executor withQueueMax(int queueMax)
Copyright © 2021 Rocket Partners, LLC. All rights reserved.