Package qupath.lib.plugins
Class TaskRunnerUtils
java.lang.Object
qupath.lib.plugins.TaskRunnerUtils
A utility class to help with the creation of
TaskRunner instances.
An application can use setCreateFunction(IntFunction) and #setCreateHeadlessFunction(IntFunction)} to
control the creation of TaskRunner instances.
- Since:
- v0.5.0
-
Method Summary
Modifier and TypeMethodDescriptionCreate a new headlessTaskRunnerinstance, using the default number of threads fromThreadTools.getParallelism().createHeadlessTaskRunner(int nThreads) Create a new headlessTaskRunnerinstance with the specified number of threads.Create a newTaskRunnerinstance, using the default number of threads fromThreadTools.getParallelism().createTaskRunner(int nThreads) Create a newTaskRunnerinstance with the specified number of threads.static IntFunction<TaskRunner>Get the default function used to createTaskRunnerinstances.static TaskRunnerUtilsGet the default instance.static TaskRunnerUtilsCreate a new instance.setCreateFunction(IntFunction<TaskRunner> function) Set the function used to generate new headlessTaskRunnerinstances.setCreateHeadlessFunction(IntFunction<TaskRunner> function) Set the function used to generate newTaskRunnerinstances.
-
Method Details
-
getDefaultInstance
Get the default instance. This is a singleton, shared across an application.- Returns:
-
newInstance
Create a new instance. This may be used if part of an application requires itsTaskRunnerinstances to differ from those used elsewhere.- Returns:
-
getDefaultCreateFunction
Get the default function used to createTaskRunnerinstances. This is suitable for use in a headless environment.- Returns:
-
setCreateHeadlessFunction
Set the function used to generate newTaskRunnerinstances.- Parameters:
function- a creator function that takes a requested number of threads as input- Returns:
- this instance
-
setCreateFunction
Set the function used to generate new headlessTaskRunnerinstances.- Parameters:
function- a creator function that takes a requested number of threads as input- Returns:
- this instance
-
createTaskRunner
Create a newTaskRunnerinstance, using the default number of threads fromThreadTools.getParallelism(). The task runner may support headless use, but does not have to.- Returns:
-
createTaskRunner
Create a newTaskRunnerinstance with the specified number of threads. The task runner may support headless use, but does not have to.- Parameters:
nThreads-- Returns:
-
createHeadlessTaskRunner
Create a new headlessTaskRunnerinstance, using the default number of threads fromThreadTools.getParallelism().- Returns:
-
createHeadlessTaskRunner
Create a new headlessTaskRunnerinstance with the specified number of threads.- Parameters:
nThreads-- Returns:
-