Class ActionExecutor
- java.lang.Object
-
- org.nuiton.jaxx.runtime.application.action.ActionExecutor
-
- All Implemented Interfaces:
Closeable,AutoCloseable
public class ActionExecutor extends Object implements Closeable
Executor ofActionWorker.- Since:
- 2.1
- Author:
- Tony Chemit - dev@tchemit.fr
-
-
Constructor Summary
Constructors Constructor Description ActionExecutor(ApplicationBoot boot, ApplicationContext context)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ActionWorker<?,?>addAction(String actionLabel, Runnable action)Add an new action to perform.voidaddActionExecutorListener(ActionExecutorListener listener)voidclose()Ask the stop any running actions.ActionExecutorListener[]getActionExecutorListeners()intgetNbActions()Set<ActionWorker<?,?>>getTasks()ThreadPoolExecutorgetWorkersExecutorService()On surcharge celui offer par SwingWorker car le corepool est à 1 et cela ne permet pas d'exécuter plusieurs actions en même temps...voidremoveActionExecutorListener(ActionExecutorListener listener)
-
-
-
Constructor Detail
-
ActionExecutor
public ActionExecutor(ApplicationBoot boot, ApplicationContext context)
-
-
Method Detail
-
addActionExecutorListener
public void addActionExecutorListener(ActionExecutorListener listener)
-
removeActionExecutorListener
public void removeActionExecutorListener(ActionExecutorListener listener)
-
getActionExecutorListeners
public ActionExecutorListener[] getActionExecutorListeners()
-
addAction
public ActionWorker<?,?> addAction(String actionLabel, Runnable action)
Add an new action to perform.- Parameters:
actionLabel- the name of the action to performaction- the action to perform- Returns:
- the worker that will launch the action
-
close
public void close()
Ask the stop any running actions.It will finish all incoming files (but will not accept more tasks).
Note: The method does not return until all tasks are not consumed.
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-
getNbActions
public int getNbActions()
-
getTasks
public Set<ActionWorker<?,?>> getTasks()
-
getWorkersExecutorService
public ThreadPoolExecutor getWorkersExecutorService()
On surcharge celui offer par SwingWorker car le corepool est à 1 et cela ne permet pas d'exécuter plusieurs actions en même temps... necessary.- Returns:
- ExecutorService for the
ActionWorker
-
-