Package com.evolveum.midpoint.task.api
Interface RunningTask
-
- All Superinterfaces:
DebugDumpable
,StatisticsCollector
,Task
public interface RunningTask extends Task
A task that is directly used to execute the handler code. It is a very sensitive structure. First of all, it must be thread-safe because it is used for the handler code execution and at the same time accessed by clients that need to check its state. There are two such situations: (1) Lightweight Asynchronous Tasks because they have no persistent representation. The only instance that exists is the one that is being executed by a handler. (2) When a client asks the task manager for a current state of the task (typically being interested in operational stats). The information could be fetched from the repository but it would be a bit outdated. This situation can be avoided by retrieving information always from the repository, sacrificing information timeliness a bit. But the (1) cannot. Some information related to task execution (e.g. list of lightweight asynchronous tasks, information on task thread, etc) is relevant only for running tasks. Therefore they are moved here.
-
-
Field Summary
-
Fields inherited from interface com.evolveum.midpoint.util.DebugDumpable
INDENT_STRING
-
Fields inherited from interface com.evolveum.midpoint.task.api.Task
DOT_INTERFACE
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
canRun()
Returns true if the task can run (was not interrupted).RunningTask
createSubtask(LightweightTaskHandler handler)
Creates a transient subtask, ready to execute a given LightweightTaskHandler.void
deleteLightweightAsynchronousSubtasks()
int
getAndIncrementObjectsSeen()
Long
getLastOperationStatsUpdateTimestamp()
Collection<? extends RunningTask>
getLightweightAsynchronousSubtasks()
LightweightTaskHandler
getLightweightTaskHandler()
long
getOperationStatsUpdateInterval()
RunningTask
getParentForLightweightAsynchronousTask()
Returns the in-memory version of the parent task.Collection<? extends RunningTask>
getRunningLightweightAsynchronousSubtasks()
void
incrementProgressAndStoreStatsIfNeeded()
boolean
isLightweightAsynchronousTask()
boolean
lightweightHandlerStartRequested()
void
refreshLowLevelStatistics()
Call from the thread that executes the task ONLY! Otherwise wrong data might be recorded.boolean
requestTracingIfNeeded(RunningTask coordinatorTask, int objectsSeen, TracingRootType defaultTracingRoot)
EXPERIMENTALvoid
setOperationStatsUpdateInterval(long interval)
void
startCollectingOperationStats(@NotNull StatisticsCollectionStrategy strategy, boolean initialExecution)
void
startDynamicProfilingIfNeeded(RunningTask coordinatorTask, int objectsSeen)
Must be called from the thread that executes the task.void
startLightweightHandler()
Starts execution of a transient task carrying a LightweightTaskHandler.void
stopDynamicProfiling()
Must be called from the thread that executes the task.void
stopTracing()
EXPERIMENTALvoid
storeOperationStats()
void
storeOperationStatsDeferred()
void
storeOperationStatsIfNeeded()
-
Methods inherited from interface com.evolveum.midpoint.util.DebugDumpable
debugDump, debugDump, debugDumpLazily, debugDumpLazily
-
Methods inherited from interface com.evolveum.midpoint.schema.statistics.StatisticsCollector
getLastFailures, markObjectActionExecutedBoundary, recordIterativeOperationEnd, recordIterativeOperationEnd, recordIterativeOperationStart, recordIterativeOperationStart, recordMappingOperation, recordNotificationOperation, recordObjectActionExecuted, recordObjectActionExecuted, recordObjectActionExecuted, recordProvisioningOperation, recordState, recordSynchronizationOperationEnd, recordSynchronizationOperationEnd, resetActionsExecutedInformation, resetEnvironmentalPerformanceInformation, resetIterativeTaskInformation, resetSynchronizationInformation
-
Methods inherited from interface com.evolveum.midpoint.task.api.Task
addDependent, addExtensionProperty, addExtensionReference, addTracingRequest, close, createSubtask, deleteDependent, deleteExtensionProperty, finishHandler, flushPendingModifications, getAggregatedLiveOperationStats, getAssignments, getBinding, getCachingProfiles, getCategory, getChannel, getClonedTaskObject, getCompletionTimestamp, getDependents, getDescription, getExecutionConstraints, getExecutionEnvironment, getExecutionGroup, getExecutionStatus, getExpectedTotal, getExtensionClone, getExtensionContainerRealValueOrClone, getExtensionItemOrClone, getExtensionOrClone, getExtensionPropertyOrClone, getExtensionPropertyRealValue, getExtensionReferenceOrClone, getGroup, getGroups, getGroupsWithLimits, getHandlerUri, getKind, getLastRunFinishTimestamp, getLastRunStartTimestamp, getModelOperationContext, getName, getNextRunStartTime, getNode, getNodeAsObserved, getObject, getObjectOid, getObjectRefOrClone, getOid, getOperationResultHandlingStrategyName, getOrCreateExtension, getOtherHandlersUriStack, getOwner, getOwnerRef, getParent, getParentTask, getPathToRootTask, getPendingModifications, getPersistenceStatus, getPolicyRule, getProgress, getRecurrenceStatus, getRequestee, getResult, getResultStatus, getSchedule, getScheduleInterval, getSelfReference, getStateBeforeSuspend, getStoredOperationStats, getTaskIdentifier, getTaskTreeId, getThreadStopAction, getTracingProfile, getTracingRequestedFor, getTriggers, getUnpauseAction, getUpdatedOrClonedTaskObject, getUpdatedTaskObject, getVersion, getWaitingReason, getWorkManagement, getWorkState, hasAssignments, hasExtension, hasScheduleInterval, isAsynchronous, isClosed, isLooselyBound, isPartitionedMaster, isPersistent, isRecurring, isResilient, isScavenger, isSingle, isTightlyBound, isTransient, listDependents, listPrerequisiteTasks, listSubtasks, listSubtasks, listSubtasksDeeply, listSubtasksDeeply, makeRecurring, makeRecurringCron, makeRecurringSimple, makeRunnable, makeSingle, makeSingle, makeWaiting, makeWaiting, makeWaiting, modify, modify, modifyAndFlush, modifyExtension, pushHandlerUri, pushHandlerUri, pushHandlerUri, refresh, removeTracingRequests, setBinding, setBindingImmediate, setCategory, setChannel, setChannelImmediate, setDescription, setDescriptionImmediate, setExecutionConstraints, setExecutionEnvironment, setExecutionEnvironmentTransient, setExpectedTotal, setExpectedTotalImmediate, setExtensionContainer, setExtensionContainerValue, setExtensionItem, setExtensionProperty, setExtensionPropertyImmediate, setExtensionPropertyValue, setExtensionPropertyValueTransient, setExtensionReference, setHandlerUri, setHandlerUriImmediate, setInitialExecutionStatus, setModelOperationContext, setName, setName, setNameImmediate, setObjectRef, setObjectRef, setObjectRefImmediate, setObjectTransient, setOwner, setProgress, setProgressImmediate, setProgressTransient, setRequesteeTransient, setResult, setResultImmediate, setResultTransient, setThreadStopAction, setTracingProfile, startWaitingForTasksImmediate
-
-
-
-
Method Detail
-
canRun
boolean canRun()
Returns true if the task can run (was not interrupted). Will return false e.g. if shutdown was signaled. BEWARE: this flag is present only on the instance of the task that is being "executed", i.e. passed to task execution routine and task handler(s).- Returns:
- true if the task can run
-
createSubtask
RunningTask createSubtask(LightweightTaskHandler handler)
Creates a transient subtask, ready to execute a given LightweightTaskHandler. Owner is inherited from parent task to subtask.
-
getParentForLightweightAsynchronousTask
RunningTask getParentForLightweightAsynchronousTask()
Returns the in-memory version of the parent task. Applicable only to lightweight subtasks. EXPERIMENTAL (use with care)
-
getLightweightTaskHandler
LightweightTaskHandler getLightweightTaskHandler()
-
isLightweightAsynchronousTask
boolean isLightweightAsynchronousTask()
-
getLightweightAsynchronousSubtasks
Collection<? extends RunningTask> getLightweightAsynchronousSubtasks()
-
getRunningLightweightAsynchronousSubtasks
Collection<? extends RunningTask> getRunningLightweightAsynchronousSubtasks()
-
lightweightHandlerStartRequested
boolean lightweightHandlerStartRequested()
-
startLightweightHandler
void startLightweightHandler()
Starts execution of a transient task carrying a LightweightTaskHandler. (just a shortcut to analogous call in TaskManager)
-
startCollectingOperationStats
void startCollectingOperationStats(@NotNull @NotNull StatisticsCollectionStrategy strategy, boolean initialExecution)
-
storeOperationStatsDeferred
void storeOperationStatsDeferred()
-
refreshLowLevelStatistics
void refreshLowLevelStatistics()
Call from the thread that executes the task ONLY! Otherwise wrong data might be recorded.
-
storeOperationStats
void storeOperationStats()
-
storeOperationStatsIfNeeded
void storeOperationStatsIfNeeded()
-
getLastOperationStatsUpdateTimestamp
Long getLastOperationStatsUpdateTimestamp()
-
setOperationStatsUpdateInterval
void setOperationStatsUpdateInterval(long interval)
-
getOperationStatsUpdateInterval
long getOperationStatsUpdateInterval()
-
incrementProgressAndStoreStatsIfNeeded
void incrementProgressAndStoreStatsIfNeeded()
-
deleteLightweightAsynchronousSubtasks
void deleteLightweightAsynchronousSubtasks()
-
getAndIncrementObjectsSeen
int getAndIncrementObjectsSeen()
-
startDynamicProfilingIfNeeded
void startDynamicProfilingIfNeeded(RunningTask coordinatorTask, int objectsSeen)
Must be called from the thread that executes the task. EXPERIMENTAL; consider moving to AbstractSearchIterativeResultHandler
-
stopDynamicProfiling
void stopDynamicProfiling()
Must be called from the thread that executes the task.
-
requestTracingIfNeeded
boolean requestTracingIfNeeded(RunningTask coordinatorTask, int objectsSeen, TracingRootType defaultTracingRoot)
EXPERIMENTAL
-
stopTracing
void stopTracing()
EXPERIMENTAL
-
-