java.lang.Object
simpa.core.api.track.ParallelTracker
Class that sets up the BlockingExecutor for queue based multi threaded
tracking and adds the tracking tasks to the queue.
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a ParallelTracker with all available processor cores and sets up the BlockingExecutor.ParallelTracker
(int nThreads) Constructs a ParallelTracker with the given number of processor threads and sets up the BlockingExecutor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds the task to the queue.void
Adds the task to the queue.void
shutdown()
Shuts down the underlying thread pool.void
Awaits the termination of all tasks on all threads.
-
Constructor Details
-
ParallelTracker
public ParallelTracker()Constructs a ParallelTracker with all available processor cores and sets up the BlockingExecutor. -
ParallelTracker
public ParallelTracker(int nThreads) Constructs a ParallelTracker with the given number of processor threads and sets up the BlockingExecutor.- Parameters:
nThreads
- The amount of threads to use.
-
-
Method Details
-
addCopyToQueue
Adds the task to the queue. The potential provider object in the task will be deep copied, so all the task can share the same instance and still the executing threads will not interfere.- Parameters:
task
- A tracking task to be added to the queue.
-
addToQueue
Adds the task to the queue. It is the responsibility of the caller to make sure the PotentialProvider objects inside each task are unique, so the threads of the queue will not interfere with each other.- Parameters:
task
- A tracking task to be added to the queue.
-
waitTermination
public void waitTermination()Awaits the termination of all tasks on all threads. -
shutdown
public void shutdown()Shuts down the underlying thread pool.
-