Package com.powsybl.afs
Interface TaskMonitor
-
- All Superinterfaces:
AutoCloseable
- All Known Implementing Classes:
LocalTaskMonitor
,RemoteTaskMonitor
public interface TaskMonitor extends AutoCloseable
- Author:
- Geoffroy Jamgotchian
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
TaskMonitor.NotACancellableTaskMonitor
static class
TaskMonitor.Snapshot
static class
TaskMonitor.Task
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
addListener(TaskListener listener)
Add a listener to task eventsboolean
cancelTaskComputation(UUID id)
Try cancel/stop the computation process monitored by this task.void
close()
void
removeListener(TaskListener listener)
Remove a listener of task eventsTaskMonitor.Task
startTask(ProjectFile projectFile)
Create a task monitoring objectTaskMonitor.Task
startTask(String name, Project project)
Create a task monitoring objectvoid
stopTask(UUID id)
Remove the task monitoring object.TaskMonitor.Snapshot
takeSnapshot(String projectId)
Return the complete state of tasks related to a projectvoid
updateTaskFuture(UUID taskId, Future future)
Update the future of the computation process monitored by this taskvoid
updateTaskMessage(UUID id, String message)
Update the display status of the task
-
-
-
Method Detail
-
startTask
TaskMonitor.Task startTask(ProjectFile projectFile)
Create a task monitoring object- Parameters:
projectFile
- related project file- Returns:
- the newly created task
-
startTask
TaskMonitor.Task startTask(String name, Project project)
Create a task monitoring object- Parameters:
name
- name of the taskproject
- related project- Returns:
- the newly created task
-
stopTask
void stopTask(UUID id)
Remove the task monitoring object. To stop the process monitored by this task, usecancelTaskComputation(java.util.UUID)
- Parameters:
id
- id of the task
-
updateTaskMessage
void updateTaskMessage(UUID id, String message)
Update the display status of the task- Parameters:
id
- id of the taskmessage
- new status message
-
takeSnapshot
TaskMonitor.Snapshot takeSnapshot(String projectId)
Return the complete state of tasks related to a project- Parameters:
projectId
- related project- Returns:
-
cancelTaskComputation
boolean cancelTaskComputation(UUID id)
Try cancel/stop the computation process monitored by this task. ThestopTask(UUID)
must still be called afterward to clean the task monitor object- Parameters:
id
- the id of the task- Returns:
- a boolean indicating if the cancellation process has succeeded
-
addListener
void addListener(TaskListener listener)
Add a listener to task events- Parameters:
listener
-
-
removeListener
void removeListener(TaskListener listener)
Remove a listener of task events- Parameters:
listener
-
-
updateTaskFuture
void updateTaskFuture(UUID taskId, Future future) throws TaskMonitor.NotACancellableTaskMonitor
Update the future of the computation process monitored by this task- Parameters:
taskId
-future
-- Throws:
TaskMonitor.NotACancellableTaskMonitor
- in case the task monitor is operating as a remote task monitor
-
close
void close()
- Specified by:
close
in interfaceAutoCloseable
-
-