Package org.testng.internal.thread.graph
Class GraphThreadPoolExecutor<T>
java.lang.Object
java.util.concurrent.AbstractExecutorService
java.util.concurrent.ThreadPoolExecutor
org.testng.internal.thread.graph.GraphThreadPoolExecutor<T>
- All Implemented Interfaces:
Executor
,ExecutorService
,ITestNGThreadPoolExecutor
public class GraphThreadPoolExecutor<T>
extends ThreadPoolExecutor
implements ITestNGThreadPoolExecutor
An Executor that launches tasks per batches. It takes a
DynamicGraph
of tasks to be run
and a IThreadWorkerFactory
to initialize/create Runnable
wrappers around those
tasks-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class java.util.concurrent.ThreadPoolExecutor
ThreadPoolExecutor.AbortPolicy, ThreadPoolExecutor.CallerRunsPolicy, ThreadPoolExecutor.DiscardOldestPolicy, ThreadPoolExecutor.DiscardPolicy
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Comparator<T>
private final IThreadWorkerFactory<T>
private final IDynamicGraph<T>
-
Constructor Summary
ConstructorsConstructorDescriptionGraphThreadPoolExecutor
(String name, IDynamicGraph<T> graph, IThreadWorkerFactory<T> factory, int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue<Runnable> workQueue, Comparator<T> comparator) -
Method Summary
Modifier and TypeMethodDescriptionvoid
afterExecute
(Runnable r, Throwable t) private IDynamicGraph.Status
private void
handleThreadAffinity
(List<T> freeNodes) private void
mapNodeToParent
(List<T> freeNodes) private void
void
run()
Helps kick start the execution and is the point of entry for execution.private void
Create one worker per node and execute them.private void
setStatus
(IWorker<T> worker, IDynamicGraph.Status status) Methods inherited from class java.util.concurrent.ThreadPoolExecutor
allowCoreThreadTimeOut, allowsCoreThreadTimeOut, awaitTermination, beforeExecute, execute, finalize, getActiveCount, getCompletedTaskCount, getCorePoolSize, getKeepAliveTime, getLargestPoolSize, getMaximumPoolSize, getPoolSize, getQueue, getRejectedExecutionHandler, getTaskCount, getThreadFactory, isShutdown, isTerminated, isTerminating, prestartAllCoreThreads, prestartCoreThread, purge, remove, setCorePoolSize, setKeepAliveTime, setMaximumPoolSize, setRejectedExecutionHandler, setThreadFactory, shutdown, shutdownNow, terminated, toString
Methods inherited from class java.util.concurrent.AbstractExecutorService
invokeAll, invokeAll, invokeAny, invokeAny, newTaskFor, newTaskFor, submit, submit, submit
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.concurrent.ExecutorService
awaitTermination, invokeAll, invokeAll, invokeAny, invokeAny, isShutdown, isTerminated, shutdown, shutdownNow, submit, submit, submit
-
Field Details
-
m_graph
-
m_factory
-
mapping
-
upstream
-
m_comparator
-
-
Constructor Details
-
GraphThreadPoolExecutor
public GraphThreadPoolExecutor(String name, IDynamicGraph<T> graph, IThreadWorkerFactory<T> factory, int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue<Runnable> workQueue, Comparator<T> comparator)
-
-
Method Details
-
run
public void run()Description copied from interface:ITestNGThreadPoolExecutor
Helps kick start the execution and is the point of entry for execution.- Specified by:
run
in interfaceITestNGThreadPoolExecutor
-
runNodes
Create one worker per node and execute them. -
afterExecute
- Overrides:
afterExecute
in classThreadPoolExecutor
-
setStatus
-
computeStatus
-
mapNodeToWorker
-
mapNodeToParent
-
handleThreadAffinity
-