$darkmode
DENOPTIM
denoptim.task.Task Class Referenceabstract

A task that can throw exceptions. More...

Inheritance diagram for denoptim.task.Task:
[legend]
Collaboration diagram for denoptim.task.Task:
[legend]

Public Member Functions

 Task (final int id)
 
int getId ()
 
void setVerbosity (int verbosity)
 Set the verbosity: i.e., amount of log printed by this class. More...
 
void setWorkSpace (File workDir)
 Sets the pathname of the work space, i.e., the location where the task is supposed to use move to or to threat as the result of "pwd" at runtime. More...
 
boolean isCompleted ()
 
boolean foundException ()
 
Throwable getException ()
 
String getErrorMessage ()
 
void stopTask ()
 Stop the task if not already completed. More...
 
String toString ()
 Returns a string identifying this task by its ID and reporting whether an exception has been thrown and if the tasks is completed. More...
 
void setNotify (boolean notify)
 

Public Attributes

Object lock = new Object()
 Lock for addressing synchronization issues. More...
 

Protected Attributes

boolean notifyGlobalTaskManager = false
 Flag controlling whether this task is expected to notify the static task manager. More...
 
boolean completed = false
 Flag about completion. More...
 
boolean hasException = false
 Flag about exception. More...
 
String errMsg = ""
 Error message produced by any subtask. More...
 
Throwable thrownExc
 Exception thrown. More...
 
int id
 A user-assigned id for this task. More...
 
ProcessHandler processHandler
 Executor for external bash script. More...
 
File workDir
 The file system location where we want to be placed when doing the work. More...
 
int verbosity = 0
 Verbosity level. More...
 
final String SEP = System.getProperty("file.separator")
 System-dependent file separator. More...
 
final String NL = System.getProperty("line.separator")
 System-dependent line separator (newline) More...
 

Detailed Description

A task that can throw exceptions.

Definition at line 29 of file Task.java.

Constructor & Destructor Documentation

◆ Task()

denoptim.task.Task.Task ( final int  id)

Definition at line 97 of file Task.java.

References denoptim.task.Task.id.

Member Function Documentation

◆ foundException()

boolean denoptim.task.Task.foundException ( )
Returns
true if an exception has been thrown within this subtask, which also includes the scenario where the executed external script returned a non-zero exit status.

Definition at line 146 of file Task.java.

References denoptim.task.Task.hasException.

◆ getErrorMessage()

String denoptim.task.Task.getErrorMessage ( )
Returns
the error message from this task.

Definition at line 166 of file Task.java.

References denoptim.task.Task.errMsg.

◆ getException()

Throwable denoptim.task.Task.getException ( )
Returns
the exception thrown within this task.

Definition at line 156 of file Task.java.

References denoptim.task.Task.thrownExc.

◆ getId()

int denoptim.task.Task.getId ( )

Definition at line 104 of file Task.java.

References denoptim.task.Task.id.

Referenced by denoptim.task.ParallelAsynchronousTaskExecutor.submitTask().

Here is the caller graph for this function:

◆ isCompleted()

boolean denoptim.task.Task.isCompleted ( )
Returns
true if the task is completed

Definition at line 134 of file Task.java.

References denoptim.task.Task.completed.

Referenced by denoptim.combinatorial.CombinatorialExplorerByLayer.makeCheckPoint().

Here is the caller graph for this function:

◆ setNotify()

void denoptim.task.Task.setNotify ( boolean  notify)

Definition at line 217 of file Task.java.

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

Here is the caller graph for this function:

◆ setVerbosity()

void denoptim.task.Task.setVerbosity ( int  verbosity)

Set the verbosity: i.e., amount of log printed by this class.

Definition at line 114 of file Task.java.

References denoptim.task.Task.verbosity.

◆ setWorkSpace()

void denoptim.task.Task.setWorkSpace ( File  workDir)

Sets the pathname of the work space, i.e., the location where the task is supposed to use move to or to threat as the result of "pwd" at runtime.

Definition at line 124 of file Task.java.

References denoptim.task.Task.workDir.

◆ stopTask()

void denoptim.task.Task.stopTask ( )

Stop the task if not already completed.

Definition at line 177 of file Task.java.

References denoptim.task.Task.completed, denoptim.task.Task.notifyGlobalTaskManager, denoptim.task.Task.processHandler, denoptim.task.ProcessHandler.stopProcess(), and denoptim.task.StaticTaskManager.subtractDoneTask().

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

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

◆ toString()

String denoptim.task.Task.toString ( )

Returns a string identifying this task by its ID and reporting whether an exception has been thrown and if the tasks is completed.

Definition at line 205 of file Task.java.

References denoptim.task.Task.completed, and denoptim.task.Task.hasException.

Member Data Documentation

◆ completed

◆ errMsg

◆ hasException

◆ id

int denoptim.task.Task.id
protected

A user-assigned id for this task.


This id is used as a task identifier when canceling or restarting a task using the remote management functionalities.

Definition at line 68 of file Task.java.

Referenced by denoptim.fragmenter.FragmenterTask.FragmenterTask(), denoptim.task.Task.getId(), denoptim.task.ProgramTask.ProgramTask(), and denoptim.task.Task.Task().

◆ lock

Object denoptim.task.Task.lock = new Object()

Lock for addressing synchronization issues.

Definition at line 51 of file Task.java.

Referenced by denoptim.task.FitnessTask.runExternalFitness().

◆ NL

◆ notifyGlobalTaskManager

boolean denoptim.task.Task.notifyGlobalTaskManager = false
protected

Flag controlling whether this task is expected to notify the static task manager.

Definition at line 35 of file Task.java.

Referenced by denoptim.task.ProgramTask.call(), and denoptim.task.Task.stopTask().

◆ processHandler

ProcessHandler denoptim.task.Task.processHandler
protected

Executor for external bash script.

Definition at line 73 of file Task.java.

Referenced by denoptim.task.FitnessTask.runExternalFitness(), and denoptim.task.Task.stopTask().

◆ SEP

final String denoptim.task.Task.SEP = System.getProperty("file.separator")
protected

◆ thrownExc

◆ verbosity

int denoptim.task.Task.verbosity = 0
protected

◆ workDir

File denoptim.task.Task.workDir
protected

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