Package qupath.lib.plugins
Class AbstractTaskRunner
java.lang.Object
qupath.lib.plugins.AbstractTaskRunner
- All Implemented Interfaces:
- TaskRunner
- Direct Known Subclasses:
- CommandLineTaskRunner,- TaskRunnerFX
Abstract PluginRunner to help with the creation of plugin runners for specific circumstances,
 e.g. running through a GUI, or from a command line only.
- 
Constructor SummaryConstructorsModifierConstructorDescriptionprotectedConstructor for a PluginRunner that uses the default number of threads, read fromThreadTools.getParallelism().protectedAbstractTaskRunner(int numThreads) Constructor for a PluginRunner that optionally uses a fixed number of threads.
- 
Method SummaryModifier and TypeMethodDescriptionprotected voidAwait the completion of currently-running tasks, notifying any listener if necessary.booleanQuery if the plugin can be cancelled while running.protected abstract SimpleProgressMonitorCreate a progress monitor to update the user on what is happening.protected voidpostProcess(Collection<? extends PathTask> tasks) Perform post-processing after a task has complete.voidrunTasks(String message, Collection<? extends Runnable> tasks) Pass a collection of parallelizable tasks to run.Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface qupath.lib.plugins.TaskRunnerrunTasks
- 
Constructor Details- 
AbstractTaskRunnerprotected AbstractTaskRunner()Constructor for a PluginRunner that uses the default number of threads, read fromThreadTools.getParallelism().
- 
AbstractTaskRunnerprotected AbstractTaskRunner(int numThreads) Constructor for a PluginRunner that optionally uses a fixed number of threads.- Parameters:
- numThreads- the number of threads to use, or -1 to use the default number of threads defined by- ThreadTools.getParallelism().
 
 
- 
- 
Method Details- 
makeProgressMonitorCreate a progress monitor to update the user on what is happening.- Returns:
 
- 
runTasksDescription copied from interface:TaskRunnerPass a collection of parallelizable tasks to run.- Specified by:
- runTasksin interface- TaskRunner
- Parameters:
- message- optional message to display to the user when running tasks; may be null
- tasks- the tasks to run. If these are instances of- PathTaskthen an optional postprocessing may be applied after all tasks are complete.
 
- 
awaitCompletionprotected void awaitCompletion()Await the completion of currently-running tasks, notifying any listener if necessary.
- 
postProcessPerform post-processing after a task has complete. This is necessary to call the taskComplete method (if the Runnable is an instance of PathTask), and also to update any progress monitor. Note: Subclasses may choose to override this method so that it is called on a particular thread (e.g. with Platform.runLater() or SwingUtilities.invokeLater).- Parameters:
- tasks-
 
- 
isCancelledpublic boolean isCancelled()Description copied from interface:TaskRunnerQuery if the plugin can be cancelled while running. Plugins are expected to check this flag before time-consuming operations.- Specified by:
- isCancelledin interface- TaskRunner
- Returns:
 
 
-