Package jadex.concurrent
Interface IThreadPool
- All Known Implementing Classes:
JavaThreadPool
,ThreadPool
public interface IThreadPool
Common interface for different thread pool implementations.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addFinishListener
(jadex.common.IChangeListener<Void> listener) Add a finished listener.void
dispose()
Shutdown the thread pool.void
Execute a task in its own thread.void
executeForever
(Runnable task) Execute a task in its own thread.boolean
Test if the thread pool is running.
-
Method Details
-
execute
Execute a task in its own thread.- Parameters:
task
- The task to execute.
-
executeForever
Execute a task in its own thread. The pool expects the thread executing the task to never return. Preferably use this method if you want to permanently retrieve a thread e.g. for repeated blocking operations. Consider requesting the daemon version.- Parameters:
task
- The task to execute.
-
dispose
void dispose()Shutdown the thread pool. -
isRunning
boolean isRunning()Test if the thread pool is running. -
addFinishListener
Add a finished listener.
-