public interface ManagedTask
It can be created by ManagedTasks.createManagedTaskSetup(String)
and is used to report
potentially long running acitivities to the administrator.
A managed task is created using a ManagedTaskSetup
. The acutal runnable being executed uses a
ManagedTaskContext
to interact with the system. A ManagedTask
is the supervisor interface
which mainly reports the state of running tasks.
Modifier and Type | Interface and Description |
---|---|
static class |
ManagedTask.State
Enuemrates possible states of a task.
|
Modifier and Type | Method and Description |
---|---|
void |
cancel()
Cancels the execution of the task.
|
String |
getCategory()
Returns the category (executor) in which the task was started.
|
String |
getId()
Contains the unique ID of the task.
|
List<TaskLogEntry> |
getLastLogs()
Returns the latest log entries.
|
String |
getName()
Returns a descriptive name of the task.
|
Instant |
getScheduled()
Returns the timestamp when the task was scheduled (started in the users eye).
|
Instant |
getStarted()
Returns the timestamp when the execution of the task started.
|
ManagedTask.State |
getState()
Returns the state of the task.
|
String |
getStateString()
Returns a short textual description of what the task is currently doing.
|
String |
getTenantId()
Contains the unique ID of the tenant the user who started the task belongs to if present.
|
Instant |
getTerminated()
Returns the timestamp when the execution of the task finished.
|
List<sirius.kernel.commons.Tuple<String,String>> |
getTimings()
Returns a list of all recorded performance counters.
|
String |
getUserId()
Contains the unique ID of the user that started the task.
|
String |
getUsername()
Returns the name of the user that started the task.
|
String getId()
@Nullable String getUserId()
@Nullable String getUsername()
@Nullable String getTenantId()
Instant getScheduled()
@Nullable Instant getStarted()
@Nullable Instant getTerminated()
String getName()
String getCategory()
Tasks.executor(String)
ManagedTask.State getState()
@Nullable String getStateString()
List<TaskLogEntry> getLastLogs()
The log is limited to a sane number of entries to pevent excessive memory usage.
List<sirius.kernel.commons.Tuple<String,String>> getTimings()
The first part of the tuple will be the name of the counter. The second will contain the counter value along with the avarage duration (if supplied).
void cancel()
Copyright © 2018. All rights reserved.