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 Executor
execute
in interface TeiidExecutor
protected void logWaitMessage(long warnTime, int maximumPoolSize, String poolName, int highestQueueSize)
public int getActiveCount()
getActiveCount
in interface TeiidExecutor
public long getSubmittedCount()
public long getCompletedCount()
public boolean isTerminated()
public void shutdown()
public int getLargestPoolSize()
public int getQueued()
getQueued
in interface TeiidExecutor
public WorkerPoolStatisticsMetadata getStats()
getStats
in interface TeiidExecutor
public List<Runnable> shutdownNow()
shutdownNow
in interface TeiidExecutor
public boolean awaitTermination(long timeout, TimeUnit unit) throws InterruptedException
awaitTermination
in interface TeiidExecutor
InterruptedException
Copyright © 2020. All rights reserved.