$darkmode
DENOPTIM
|
Manager for tasks submitted by the GUI. More...
Classes | |
class | ShutDownHook |
Shutdown hook that stops all child tasks upon shutdown of JavaVM. More... | |
Static Public Member Functions | |
static StaticTaskManager | getInstance () |
Gets the singleton instance of this class. More... | |
static void | addTodoTask () |
static void | addTodoTasks (int addedTasksCount) |
static void | subtractDoneTask () |
static void | subtractDoneTasks (int doneTasksCount) |
static String | getQueueSnapshot () |
static void | submitAndWait (Task task) throws InterruptedException, ExecutionException |
Submits a task and waits for completion. More... | |
static void | submit (Task task) |
static void | stop (Task task) |
static void | stopAll () |
static boolean | hasActive () |
static void | setLinkToProgressBar (JProgressBar bar) |
Adds a reference to the given progress bar. More... | |
Static Public Attributes | |
static int | valProgressBar = 1 |
Value indicated in the progress bar of the GUI. More... | |
static int | maxProgressBar = 1 |
Queue max indicator for progress bar in GUI. More... | |
static JProgressBar | queueStatusBar = null |
Reference to progress bar in GUI. More... | |
static final String | PROGRESSBARUPDATE = "UPDATE-PROGRESS-BAR" |
Property change fired to indicate the need to update progress bar. More... | |
Private Member Functions | |
StaticTaskManager () | |
Static Private Attributes | |
static final StaticTaskManager | instance = new StaticTaskManager() |
The only, static instance of this class. More... | |
static ThreadPoolExecutor | tpe |
The executor of threads. More... | |
static Map< Task, Future<?> > | subToFutureMap |
Maps the relation between a task that is submitted and its future handle. More... | |
static final int | maxParallelPrograms = 4 |
Maximum number of denoptim ProgramTask s that can be run in parallel. More... | |
static final int | queueSize = 10 |
Queue size. More... | |
static final Object | LOCK = new Object() |
Synchronisation lock for queue progress bar. More... | |
Manager for tasks submitted by the GUI.
The main purpose is to launch and manage calls placed upon requests coming from the GUI and aimed at running DENOPTIM's main classes in GARunner
and FragSpaceExplorer
.
Definition at line 44 of file StaticTaskManager.java.
|
private |
Definition at line 100 of file StaticTaskManager.java.
References denoptim.task.StaticTaskManager.maxParallelPrograms, denoptim.task.StaticTaskManager.queueSize, and denoptim.task.StaticTaskManager.tpe.
|
static |
Definition at line 178 of file StaticTaskManager.java.
References denoptim.task.StaticTaskManager.addTodoTasks().
Referenced by denoptim.task.StaticTaskManager.submit().
|
static |
Definition at line 185 of file StaticTaskManager.java.
References denoptim.task.StaticTaskManager.LOCK, denoptim.task.StaticTaskManager.maxProgressBar, denoptim.task.StaticTaskManager.queueStatusBar, and denoptim.task.StaticTaskManager.valProgressBar.
Referenced by denoptim.task.StaticTaskManager.addTodoTask().
|
static |
Gets the singleton instance of this class.
Definition at line 171 of file StaticTaskManager.java.
References denoptim.task.StaticTaskManager.instance.
Referenced by denoptim.main.Main.main().
|
static |
Definition at line 243 of file StaticTaskManager.java.
References denoptim.task.StaticTaskManager.tpe.
Referenced by denoptim.gui.GUIPrepare.initialize().
|
static |
Definition at line 302 of file StaticTaskManager.java.
References denoptim.task.StaticTaskManager.tpe.
Referenced by denoptim.gui.GUI.closeIfAllSaved().
|
static |
Adds a reference to the given progress bar.
This to enable the task manager to report queue status.
bar |
Definition at line 314 of file StaticTaskManager.java.
References denoptim.task.StaticTaskManager.queueStatusBar.
Referenced by denoptim.gui.MainToolBar.initialize().
|
static |
Definition at line 278 of file StaticTaskManager.java.
References denoptim.task.Task.stopTask(), and denoptim.task.StaticTaskManager.subToFutureMap.
|
static |
Definition at line 290 of file StaticTaskManager.java.
References denoptim.task.StaticTaskManager.subToFutureMap.
Referenced by denoptim.gui.GUI.closeIfAllSaved(), denoptim.task.StaticTaskManager.ShutDownHook.run(), and denoptim.main.Main.terminate().
|
static |
Definition at line 268 of file StaticTaskManager.java.
References denoptim.task.StaticTaskManager.addTodoTask(), denoptim.task.Task.setNotify(), denoptim.task.StaticTaskManager.subToFutureMap, and denoptim.task.StaticTaskManager.tpe.
Referenced by denoptim.gui.GUIPrepare.initialize().
|
static |
Submits a task and waits for completion.
task | the task to submit. |
ExecutionException | |
InterruptedException |
Definition at line 260 of file StaticTaskManager.java.
References denoptim.task.StaticTaskManager.tpe.
Referenced by denoptim.main.Main.runProgramTask().
|
static |
Definition at line 211 of file StaticTaskManager.java.
References denoptim.task.StaticTaskManager.subtractDoneTasks().
Referenced by denoptim.task.ProgramTask.call(), and denoptim.task.Task.stopTask().
|
static |
Definition at line 218 of file StaticTaskManager.java.
References denoptim.task.StaticTaskManager.LOCK, denoptim.task.StaticTaskManager.maxProgressBar, denoptim.task.StaticTaskManager.queueStatusBar, and denoptim.task.StaticTaskManager.valProgressBar.
Referenced by denoptim.task.StaticTaskManager.subtractDoneTask().
|
staticprivate |
The only, static instance of this class.
Definition at line 49 of file StaticTaskManager.java.
Referenced by denoptim.task.StaticTaskManager.getInstance().
|
staticprivate |
Synchronisation lock for queue progress bar.
Definition at line 96 of file StaticTaskManager.java.
Referenced by denoptim.task.StaticTaskManager.addTodoTasks(), and denoptim.task.StaticTaskManager.subtractDoneTasks().
|
staticprivate |
Maximum number of denoptim ProgramTask
s that can be run in parallel.
Definition at line 66 of file StaticTaskManager.java.
Referenced by denoptim.task.StaticTaskManager.StaticTaskManager().
|
static |
Queue max indicator for progress bar in GUI.
Definition at line 81 of file StaticTaskManager.java.
Referenced by denoptim.task.StaticTaskManager.addTodoTasks(), and denoptim.task.StaticTaskManager.subtractDoneTasks().
|
static |
Property change fired to indicate the need to update progress bar.
Definition at line 91 of file StaticTaskManager.java.
|
staticprivate |
Queue size.
Definition at line 71 of file StaticTaskManager.java.
Referenced by denoptim.task.StaticTaskManager.StaticTaskManager().
|
static |
Reference to progress bar in GUI.
Null when we start.
Definition at line 86 of file StaticTaskManager.java.
Referenced by denoptim.task.StaticTaskManager.addTodoTasks(), denoptim.gui.GUI.run(), denoptim.task.StaticTaskManager.setLinkToProgressBar(), and denoptim.task.StaticTaskManager.subtractDoneTasks().
|
staticprivate |
Maps the relation between a task that is submitted and its future handle.
Definition at line 59 of file StaticTaskManager.java.
Referenced by denoptim.task.StaticTaskManager.ShutDownHook.run(), denoptim.task.StaticTaskManager.stop(), denoptim.task.StaticTaskManager.stopAll(), and denoptim.task.StaticTaskManager.submit().
|
staticprivate |
The executor of threads.
Definition at line 54 of file StaticTaskManager.java.
Referenced by denoptim.task.StaticTaskManager.getQueueSnapshot(), denoptim.task.StaticTaskManager.hasActive(), denoptim.task.StaticTaskManager.ShutDownHook.run(), denoptim.task.StaticTaskManager.StaticTaskManager(), denoptim.task.StaticTaskManager.submit(), and denoptim.task.StaticTaskManager.submitAndWait().
|
static |
Value indicated in the progress bar of the GUI.
Definition at line 76 of file StaticTaskManager.java.
Referenced by denoptim.task.StaticTaskManager.addTodoTasks(), and denoptim.task.StaticTaskManager.subtractDoneTasks().