public class JIPipeFixedThreadPool extends Object implements AutoCloseable
SciJava
is cached (unbounded)Constructor and Description |
---|
JIPipeFixedThreadPool(int maxThreads)
Initializes a pool with the specified amount of threads.
|
Modifier and Type | Method and Description |
---|---|
void |
close() |
ExecutorService |
getExecutorService()
Returns the
ExecutorService or null. |
int |
getMaxThreads() |
Future<Exception> |
schedule(Runnable runnable)
Schedules a runnable
|
List<Future<Exception>> |
scheduleBatches(List<Runnable> tasks,
int batchSize)
Schedules multiple tasks at once, split into batches.
|
void |
shutdown()
Forces the thread pool to shut down
|
public JIPipeFixedThreadPool(int maxThreads)
ExecutorService
is created and all workloads are run in single-threaded modemaxThreads
- number of threads. must be larger or equal to 1public Future<Exception> schedule(Runnable runnable)
runnable
- the functionpublic List<Future<Exception>> scheduleBatches(List<Runnable> tasks, int batchSize)
tasks
- the tasks to runbatchSize
- the number of tasks per batchpublic int getMaxThreads()
public ExecutorService getExecutorService()
ExecutorService
or null.
This will return null if getMaxThreads() is less than 1ExecutorService
or nullpublic void shutdown()
public void close() throws Exception
close
in interface AutoCloseable
Exception
Copyright © 2020–2025 Leibniz Institute for Natural Product Research and Infection Biology - Hans Knöll Institute (HKI). All rights reserved.