public class ThreadReuseExecutor extends Object implements TeiidExecutor
SynchronousQueue based ThreadPoolExecutor satisfies 1 and 2, but not 3.
A bounded or unbound queue based ThreadPoolExecutor allows for 3, but will tend to create
up to the maximum number of threads and makes no guarantee on thread scheduling.
SynchronousQueue
backed ThreadPoolExecutor.
ForkJoinPool is a simple replacement, but we'd loose the prioritization queue.| Modifier and Type | Class and Description |
|---|---|
static interface |
ThreadReuseExecutor.PrioritizedRunnable |
static class |
ThreadReuseExecutor.RunnableWrapper |
| Constructor and Description |
|---|
ThreadReuseExecutor(String name,
int maximumPoolSize) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
awaitTermination(long timeout,
TimeUnit unit) |
void |
execute(Runnable command) |
int |
getActiveCount() |
long |
getCompletedCount() |
int |
getLargestPoolSize() |
int |
getQueued() |
WorkerPoolStatisticsMetadata |
getStats() |
long |
getSubmittedCount() |
boolean |
isTerminated() |
protected void |
logWaitMessage(long warnTime,
int maximumPoolSize,
String poolName,
int highestQueueSize) |
void |
shutdown() |
List<Runnable> |
shutdownNow() |
public ThreadReuseExecutor(String name, int maximumPoolSize)
public void execute(Runnable command)
execute in interface Executorexecute in interface TeiidExecutorprotected void logWaitMessage(long warnTime,
int maximumPoolSize,
String poolName,
int highestQueueSize)
public int getActiveCount()
getActiveCount in interface TeiidExecutorpublic long getSubmittedCount()
public long getCompletedCount()
public boolean isTerminated()
public void shutdown()
public int getLargestPoolSize()
public int getQueued()
getQueued in interface TeiidExecutorpublic WorkerPoolStatisticsMetadata getStats()
getStats in interface TeiidExecutorpublic List<Runnable> shutdownNow()
shutdownNow in interface TeiidExecutorpublic boolean awaitTermination(long timeout,
TimeUnit unit)
throws InterruptedException
awaitTermination in interface TeiidExecutorInterruptedExceptionCopyright © 2019. All rights reserved.