public class DefaultTaskService extends java.lang.Object implements TaskService
TaskService interface.| Modifier and Type | Class and Description |
|---|---|
static class |
DefaultTaskService.PoolingQueueSizeGauge |
| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_POLLING_INTERVAL |
static int |
DEFAULT_SHUTDOWN_WAIT |
static int |
DEFAULT_WORKER_MAX |
static java.lang.String |
PROCESSING_HITS_METRIC |
static java.lang.String |
PROCESSING_MISSES_METRIC |
static java.lang.String |
PROCESSING_TIME_METRIC |
static java.lang.String |
QUEUE_SIZE_METRIC |
BEAN_ID| Constructor and Description |
|---|
DefaultTaskService() |
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
checkSystemOK() |
protected void |
checkTask(TaskModel toBeScheduled) |
protected void |
checkTaskConditions(TaskModel toBeScheduled,
TaskConditionModel cond) |
void |
destroy()
Shut down this component
|
TaskEngine |
getEngine() |
protected TaskExecutionStrategy |
getExecutionStrategy(TaskRunner<? extends TaskModel> runner) |
protected TaskRunner |
getRunner(java.lang.String runnerBean) |
protected TaskRunner |
getRunner(Task task) |
protected TaskDAO |
getTaskDao() |
protected TaskEngineParameters |
getTaskProviderParameters() |
protected Tenant |
getTenant() |
void |
init()
Starts up this component
|
protected boolean |
isAllowedToStart() |
protected boolean |
isAllowedToStart(int clusterId) |
protected boolean |
isEnabledInConfig()
Read configuration setting for task engine from the configuration.
|
boolean |
isRunning() |
protected void |
markTaskFailed(Task task) |
protected void |
poll() |
protected void |
process(TasksProvider.VersionPK versionPK) |
protected void |
processCondition(TaskCondition cond) |
protected void |
processInTenant(TasksProvider.VersionPK versionPK) |
protected void |
processTask(Task task,
TasksProvider.VersionPK versionPK) |
protected java.util.Set<java.lang.Integer> |
readExcludedNodesFromConfig() |
protected int |
readMaxWorkersFromConfig() |
protected int |
readPollingIntervalFromConfig() |
protected int |
readShutdownWaitFromConfig() |
protected int |
readWorkersIdleFromConfig() |
protected <T> void |
refreshCurrentSessionWithRetry(java.util.function.Supplier<java.lang.Void> failingMethodSupplier) |
void |
repoll(java.lang.Integer nodeId,
java.lang.String nodeGroupId) |
protected void |
scheduleRetry(Task task,
java.util.Date nextExecution,
int turn) |
protected boolean |
scheduleRetryIfAllowed(Task task,
RetryLaterException e) |
void |
scheduleTask(TaskModel task)
Schedule a task.
|
void |
setEventService(EventService eventService) |
void |
setMetricRegistry(MetricRegistry metricRegistry) |
void |
setModelService(ModelService modelService) |
void |
setScheduleAndTriggerStrategy(ScheduleAndTriggerStrategy scheduleAndTriggerStrategy) |
void |
setTaskDao(TaskDAO dao) |
void |
setTaskEngineRetryTemplate(RetryTemplate taskEngineRetryTemplate) |
void |
setTaskExecutionStrategies(java.util.Collection<? extends TaskExecutionStrategy> taskExecutionStrategies) |
void |
setTasksProvider(TasksProvider tasksProvider) |
void |
triggerEvent(java.lang.String uniqueId)
Trigger an event on task module.
|
void |
triggerEvent(java.lang.String uniqueId,
java.util.Date expirationDate)
Trigger an event on task module.
|
boolean |
triggerEvent(TaskEvent event)
Trigger event on task module.
|
void |
triggerRepoll(java.lang.Integer nodeId,
java.lang.String nodeGroupId)
Triggers re-poll at the specified cluster node.
|
protected void |
triggerRepollAfterSchedule(java.util.Date scheduledDate,
java.lang.Integer nodeId,
java.lang.String nodeGroupId) |
protected void |
waitAndRunExclusiveAction(java.lang.String info,
java.lang.Runnable action) |
public static final int DEFAULT_WORKER_MAX
public static final int DEFAULT_POLLING_INTERVAL
public static final int DEFAULT_SHUTDOWN_WAIT
public static final java.lang.String QUEUE_SIZE_METRIC
public static final java.lang.String PROCESSING_TIME_METRIC
public static final java.lang.String PROCESSING_HITS_METRIC
public static final java.lang.String PROCESSING_MISSES_METRIC
public void setModelService(ModelService modelService)
public void setEventService(EventService eventService)
public void setScheduleAndTriggerStrategy(ScheduleAndTriggerStrategy scheduleAndTriggerStrategy)
public void setMetricRegistry(MetricRegistry metricRegistry)
public void setTasksProvider(TasksProvider tasksProvider)
public void setTaskEngineRetryTemplate(RetryTemplate taskEngineRetryTemplate)
public TaskEngine getEngine()
getEngine in interface TaskServicepublic boolean isRunning()
public void triggerRepoll(java.lang.Integer nodeId,
java.lang.String nodeGroupId)
nodeId - the cluster node idpublic void triggerEvent(java.lang.String uniqueId)
TaskServicetriggerEvent in interface TaskServiceuniqueId - unique id of eventpublic void triggerEvent(java.lang.String uniqueId,
java.util.Date expirationDate)
TaskServicetriggerEvent in interface TaskServiceuniqueId - unique id of eventexpirationDate - expiration date - when reached the task condition created after event send and beforepublic boolean triggerEvent(TaskEvent event)
TaskServicetriggerEvent in interface TaskServiceevent - event to be triggeredtrue if operation succeeded or false if event has been already triggeredpublic void scheduleTask(TaskModel task)
TaskServicescheduleTask in interface TaskServicetask - task to schedule.protected void triggerRepollAfterSchedule(java.util.Date scheduledDate,
java.lang.Integer nodeId,
java.lang.String nodeGroupId)
protected void checkTask(TaskModel toBeScheduled)
protected void checkTaskConditions(TaskModel toBeScheduled, TaskConditionModel cond)
public void repoll(java.lang.Integer nodeId,
java.lang.String nodeGroupId)
protected boolean isAllowedToStart()
protected boolean isAllowedToStart(int clusterId)
protected boolean isEnabledInConfig()
TaskConstants.Params.TASK_PROCESSING_ENABLED and TaskConstants.Params.TASK_PROCESSING_ENABLED_LEGACY. The following applies:
protected boolean checkSystemOK()
protected <T> void refreshCurrentSessionWithRetry(java.util.function.Supplier<java.lang.Void> failingMethodSupplier)
public void init()
protected TaskDAO getTaskDao()
public void setTaskDao(TaskDAO dao)
protected int readPollingIntervalFromConfig()
protected int readMaxWorkersFromConfig()
protected int readWorkersIdleFromConfig()
protected java.util.Set<java.lang.Integer> readExcludedNodesFromConfig()
protected int readShutdownWaitFromConfig()
public void destroy()
protected void waitAndRunExclusiveAction(java.lang.String info,
java.lang.Runnable action)
protected void poll()
protected TaskEngineParameters getTaskProviderParameters()
protected void processInTenant(TasksProvider.VersionPK versionPK)
protected void process(TasksProvider.VersionPK versionPK)
protected void processCondition(TaskCondition cond)
protected void processTask(Task task, TasksProvider.VersionPK versionPK)
protected boolean scheduleRetryIfAllowed(Task task, RetryLaterException e)
protected void scheduleRetry(Task task, java.util.Date nextExecution, int turn)
protected void markTaskFailed(Task task)
protected TaskRunner getRunner(Task task)
protected TaskRunner getRunner(java.lang.String runnerBean) throws java.lang.IllegalStateException
java.lang.IllegalStateExceptionprotected Tenant getTenant()
protected TaskExecutionStrategy getExecutionStrategy(TaskRunner<? extends TaskModel> runner)
public void setTaskExecutionStrategies(java.util.Collection<? extends TaskExecutionStrategy> taskExecutionStrategies)
Copyright © 2018 SAP SE. All Rights Reserved.