@ThreadSafe public abstract class TasksWatchDog extends java.lang.Object implements WatchDog
BackgroundWorker.| Modifier and Type | Class and Description |
|---|---|
static class |
TasksWatchDog.ExecutionStatus |
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
initialized |
protected io.jmix.core.TimeSource |
timeSource |
| Constructor and Description |
|---|
TasksWatchDog() |
| Modifier and Type | Method and Description |
|---|---|
void |
cleanupTasks()
Remove finished, canceled or hangup tasks.
|
int |
getActiveTasksCount() |
protected abstract TasksWatchDog.ExecutionStatus |
getExecutionStatus(long actualTimeMs,
TaskHandlerImpl taskHandler) |
void |
manageTask(TaskHandlerImpl taskHandler)
Add task under WatchDog control.
|
void |
onContextRefreshed() |
void |
onContextStopped() |
void |
removeTask(TaskHandlerImpl taskHandler)
Task completed, remove it from watches.
|
void |
stopTasks()
Stop execution of all background tasks.
|
@Autowired protected io.jmix.core.TimeSource timeSource
protected volatile boolean initialized
@EventListener(classes={org.springframework.context.event.ContextRefreshedEvent.class,org.springframework.context.event.ContextStartedEvent.class})
public void onContextRefreshed()
@EventListener(value=org.springframework.context.event.ContextStoppedEvent.class) public void onContextStopped()
public void cleanupTasks()
WatchDogcleanupTasks in interface WatchDogprotected abstract TasksWatchDog.ExecutionStatus getExecutionStatus(long actualTimeMs, TaskHandlerImpl taskHandler)
public void stopTasks()
WatchDogpublic int getActiveTasksCount()
getActiveTasksCount in interface WatchDogpublic void manageTask(TaskHandlerImpl taskHandler)
manageTask in interface WatchDogtaskHandler - Task handlerpublic void removeTask(TaskHandlerImpl taskHandler)
WatchDogremoveTask in interface WatchDogtaskHandler - task handler