$darkmode
DENOPTIM
denoptim.task.StaticTaskManager Class Reference

Manager for tasks submitted by the GUI. More...

Collaboration diagram for denoptim.task.StaticTaskManager:
[legend]

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 ProgramTasks 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...
 

Detailed Description

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.

Author
Marco Foscato

Definition at line 44 of file StaticTaskManager.java.

Constructor & Destructor Documentation

◆ StaticTaskManager()

denoptim.task.StaticTaskManager.StaticTaskManager ( )
private

Member Function Documentation

◆ addTodoTask()

static void denoptim.task.StaticTaskManager.addTodoTask ( )
static

Definition at line 178 of file StaticTaskManager.java.

References denoptim.task.StaticTaskManager.addTodoTasks().

Referenced by denoptim.task.StaticTaskManager.submit().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ addTodoTasks()

static void denoptim.task.StaticTaskManager.addTodoTasks ( int  addedTasksCount)
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().

Here is the caller graph for this function:

◆ getInstance()

static StaticTaskManager denoptim.task.StaticTaskManager.getInstance ( )
static

Gets the singleton instance of this class.

Returns

Definition at line 171 of file StaticTaskManager.java.

References denoptim.task.StaticTaskManager.instance.

Referenced by denoptim.main.Main.main().

Here is the caller graph for this function:

◆ getQueueSnapshot()

static String denoptim.task.StaticTaskManager.getQueueSnapshot ( )
static
Returns
a string with HTML code, but no html head/tail tags. This string is meant to be inserted in a larger string with head/tail tags.

Definition at line 243 of file StaticTaskManager.java.

References denoptim.task.StaticTaskManager.tpe.

Referenced by denoptim.gui.GUIPrepare.initialize().

Here is the caller graph for this function:

◆ hasActive()

static boolean denoptim.task.StaticTaskManager.hasActive ( )
static

Definition at line 302 of file StaticTaskManager.java.

References denoptim.task.StaticTaskManager.tpe.

Referenced by denoptim.gui.GUI.closeIfAllSaved().

Here is the caller graph for this function:

◆ setLinkToProgressBar()

static void denoptim.task.StaticTaskManager.setLinkToProgressBar ( JProgressBar  bar)
static

Adds a reference to the given progress bar.

This to enable the task manager to report queue status.

Parameters
bar

Definition at line 314 of file StaticTaskManager.java.

References denoptim.task.StaticTaskManager.queueStatusBar.

Referenced by denoptim.gui.MainToolBar.initialize().

Here is the caller graph for this function:

◆ stop()

static void denoptim.task.StaticTaskManager.stop ( Task  task)
static

Definition at line 278 of file StaticTaskManager.java.

References denoptim.task.Task.stopTask(), and denoptim.task.StaticTaskManager.subToFutureMap.

Here is the call graph for this function:

◆ stopAll()

static void denoptim.task.StaticTaskManager.stopAll ( )
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().

Here is the caller graph for this function:

◆ submit()

static void denoptim.task.StaticTaskManager.submit ( Task  task)
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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ submitAndWait()

static void denoptim.task.StaticTaskManager.submitAndWait ( Task  task) throws InterruptedException, ExecutionException
static

Submits a task and waits for completion.

Parameters
taskthe task to submit.
Exceptions
ExecutionException
InterruptedException

Definition at line 260 of file StaticTaskManager.java.

References denoptim.task.StaticTaskManager.tpe.

Referenced by denoptim.main.Main.runProgramTask().

Here is the caller graph for this function:

◆ subtractDoneTask()

static void denoptim.task.StaticTaskManager.subtractDoneTask ( )
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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ subtractDoneTasks()

static void denoptim.task.StaticTaskManager.subtractDoneTasks ( int  doneTasksCount)
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().

Here is the caller graph for this function:

Member Data Documentation

◆ instance

final StaticTaskManager denoptim.task.StaticTaskManager.instance = new StaticTaskManager()
staticprivate

The only, static instance of this class.

Definition at line 49 of file StaticTaskManager.java.

Referenced by denoptim.task.StaticTaskManager.getInstance().

◆ LOCK

final Object denoptim.task.StaticTaskManager.LOCK = new Object()
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().

◆ maxParallelPrograms

final int denoptim.task.StaticTaskManager.maxParallelPrograms = 4
staticprivate

Maximum number of denoptim ProgramTasks that can be run in parallel.

Definition at line 66 of file StaticTaskManager.java.

Referenced by denoptim.task.StaticTaskManager.StaticTaskManager().

◆ maxProgressBar

int denoptim.task.StaticTaskManager.maxProgressBar = 1
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().

◆ PROGRESSBARUPDATE

final String denoptim.task.StaticTaskManager.PROGRESSBARUPDATE = "UPDATE-PROGRESS-BAR"
static

Property change fired to indicate the need to update progress bar.

Definition at line 91 of file StaticTaskManager.java.

◆ queueSize

final int denoptim.task.StaticTaskManager.queueSize = 10
staticprivate

Queue size.

Definition at line 71 of file StaticTaskManager.java.

Referenced by denoptim.task.StaticTaskManager.StaticTaskManager().

◆ queueStatusBar

JProgressBar denoptim.task.StaticTaskManager.queueStatusBar = null
static

◆ subToFutureMap

Map<Task,Future<?> > denoptim.task.StaticTaskManager.subToFutureMap
staticprivate
Initial value:
=
new HashMap<Task,Future<?>>()

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().

◆ tpe

◆ valProgressBar

int denoptim.task.StaticTaskManager.valProgressBar = 1
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().


The documentation for this class was generated from the following file: