Package de.hybris.platform.task.impl
Class AuxiliaryTablesWatchdog
java.lang.Object
de.hybris.platform.task.impl.AuxiliaryTablesWatchdog
- All Implemented Interfaces:
org.springframework.beans.factory.DisposableBean
- Direct Known Subclasses:
SchedulerAuxiliaryTablesWatchdog
public abstract class AuxiliaryTablesWatchdog
extends Object
implements org.springframework.beans.factory.DisposableBean
Manages executor service, that allows to run only one watchdog task at the moment.
The executor service uses thread poll, that creates
RegistrableThread as suspendable operation.
The executor service is destroyed while bean is disposed.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final AuxiliaryTablesWatchdogTaskNo operation watchdog task. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCreates a new watchdog instance with a specified name -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract booleancanRunWatchdog(RuntimeConfigHolder runtimeConfigHolder) Determines whether the watchdog can be runprotected abstract AuxiliaryTablesWatchdogTaskcreateTask(RuntimeConfigHolder runtimeConfigHolder, TaskEngineParameters taskEngineParameters) Creates watchdog task based on runtime configurationvoiddestroy()Shuts down the watchdog executor if it is activegetName()Provides watchdog namestartWatchdog(RuntimeConfigHolder runtimeConfigHolder, TaskEngineParameters taskEngineParameters) Starts watchdog task, that executes specified operation until stopped
-
Field Details
-
NO_OP
No operation watchdog task. Provided when watchdog is disabled and start task is invoked.
-
-
Constructor Details
-
AuxiliaryTablesWatchdog
Creates a new watchdog instance with a specified name- Parameters:
name- used to identify the thread created by the thread watchdog factory
-
-
Method Details
-
startWatchdog
public AuxiliaryTablesWatchdogTask startWatchdog(RuntimeConfigHolder runtimeConfigHolder, TaskEngineParameters taskEngineParameters) Starts watchdog task, that executes specified operation until stopped- Parameters:
runtimeConfigHolder- configuration holdertaskEngineParameters- task engine run parameters- Returns:
- watchdog task
- Throws:
IllegalStateException- thrown when watchdog cannot start a task. This may occur when there is an attempt to execute next task while the previous is still in progress.
-
createTask
protected abstract AuxiliaryTablesWatchdogTask createTask(RuntimeConfigHolder runtimeConfigHolder, TaskEngineParameters taskEngineParameters) Creates watchdog task based on runtime configuration- Parameters:
runtimeConfigHolder- runtime configuration providertaskEngineParameters- runtime parameters- Returns:
- watchdog task
-
canRunWatchdog
Determines whether the watchdog can be run- Parameters:
runtimeConfigHolder- runtime configuration provider- Returns:
trueif watchdog can be run
-
destroy
Shuts down the watchdog executor if it is active- Specified by:
destroyin interfaceorg.springframework.beans.factory.DisposableBean- Throws:
Exception
-
getName
Provides watchdog name- Returns:
- watchdog name
-