Package org.cyclos.impl.utils.tasks
Interface BackgroundTask
-
- All Superinterfaces:
HasMessageKey
public interface BackgroundTask extends HasMessageKey
A task which is executed on the background. The task information is persistent, and is removed after the processing is finished. When running in a cluster, it is guaranteed that only a single node will execute a task. BackgroundTasks are instantiated once and reused - they need to be thread safe. The process of reading the context happens in a database transaction, the execution happens outside any transaction scope, and then the record is removed in another transaction.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description longexecute(String display, String context, ProfilingEntry profilingEntry)Executes the background task with the given context.StringgetName()The name of the background task.default BackgroundTaskPrioritygetPriority()The task priority-
Methods inherited from interface org.cyclos.utils.HasMessageKey
getMessageKey
-
-
-
-
Method Detail
-
execute
long execute(String display, String context, ProfilingEntry profilingEntry)
Executes the background task with the given context. The given display name is used on logs. Returns the number of affected rows.
-
getName
String getName()
The name of the background task. Do not confuse with the display name used to log a specific execution.- Returns:
-
getPriority
default BackgroundTaskPriority getPriority()
The task priority
-
-