Class AsyncProcessingPipeline
java.lang.Object
com._1c.g5.v8.internal.derived.pipeline.AsyncProcessingPipeline
- All Implemented Interfaces:
IAsyncProcessingPipeline
Standard implementation of the DD async pipeline.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionbooleanChecks if all segments are computed.voidbindTaskToAnActiveOperationIfApplicable(Object bmOperationHandle) Binds the BM task to the manually created operationvoidBlocks pipeline computations due to external reasons.completeAutoWrappingOperationIfApplicable(Object bmOperationHandle) Finishes the auto-wrapping operation if any for the given BM operation handlevoidConfirms processing of the specified context collection.static AsyncProcessingPipelinecreate(Collection<DerivedDataSegmentDefinition> segmentDefinitions, Collection<DerivedDataSegmentDefinitionV2> segmentDefinitionsV2, IDerivedDataServiceLockController lockController, String modelId, AsyncPipelineModalModeAccessor modalModeAccessor) Creates an instance of the async derived data processing pipelinevoiddeactivateContexts(String segmentId) Deactivates contexts of a specified pipeline segment.voidDisables auto-wrapping of BM tasks with operations for the current thread.voiddumpPipelineState(IDerivedDataContextManager contextManager) voidEnables an auto-wrapping of BM tasks with orchestrator operations for the current thread.gather()Gather next derived data processing task.Checks if a supplier requests a reset of currently computed non-priority tasks (e.g. due to more prioritable operation is appeared)Gets the current stage of the DD async. pipeline.Gets the current status of the DD async. pipeline.Gets active stage lock (if any)Gets the multithreading computation policy for the current state of the pipeline.Gets the set of segments the pipeline works on at the moment.Gets ready (computed) DD segments.intgetRemainingUnitsOfWork(String segmentId) Gets the number of remaining work units for the given segment.getSegmentName(String segmentId) Gets the human-readable name (localizable) for the given DD segment,Gets the current status of the DD async. pipeline.intgetTotalUnitsOfWork(String segmentId) Gets the total number of work units for the given DD segment.Gets the current BM task wrapping operation (if any)booleanhasOperation(Object handle) Checks if the pipeline has a scheduled operationbooleanChecks if the pipeline has priority tasks ready to be computed at the momentbooleanChecks if the DD subsystem already scheduled some DD tasks for the computation.voidincreasePriority(String segmentId, long bmObjectId) Increases the priority of computation for the given BM object in a specified DD segment.voidincreasePriority(Collection<String> segments) Increase priority of all segments being supplied as a scopevoidincreasePriority(Map<Object, Collection<String>> scope) Increases the priority of computation for the given scopebooleaninSync()Checks if the pipeline performs processing ofDerivedDataSegmentBucket.SYNCstagebooleanChecks if the pipeline is blocked externallybooleanisLongRunningSegment(String segmentId) Checks if the requested DD segment is a long-running one (so the progress indication should be comprehensible to the user).booleanChecks if there is an orchestrated operation being active in the client thread.booleanisSegmentComputed(String segmentId) Checks if the DD segment is computed completely.voidMarks the operation as an auto-wrapping one.voidMarks the current thread explicitly as a participant of the modal operation.voidPrepares the pipeline for the closing.voidregisterActiveOperation(OperationContext context) Registers the active operation context for the current threadvoidRemoves all context from the async. pipeline for the given object (e.g. during removal of the object).voidremoveOperation(Object handle) Removes a previously scheduled operation from the pipeline.renderStatusText(String currentSegmentId) Renders status text for the given segment.voidResets the active pipeline status.voidresetActiveWrappingOperationContext(OperationContext operationContext) Resets the binding of an operation to the current threadvoidRe-sets the pipeline status, pipeline position, etc.voidResets the stage lock, if anyvoidschedule(Collection<IObjectDerivedDataContext> updatedContexts, Object modalOperationContext) Schedules the updated derived data contexts into the pipeline.voidsetImplicitWaitingContext(List<IObjectDerivedDataContext> changedContexts) Sets the implicit waiting context to the current wrapping operation (if any)setStageLock(DerivedDataSegmentBucket stage, boolean allowDataComputing) Sets the stage lock for a specified stage of async pipeline.voidstart(BiConsumer<String, Object> unlockNotifier) Starts a pipeline with additional callbacks required by the computation processvoidEnables the massive computing mode for the DD pipeline.voidstop()Stops the pipeline, performing all shutdown sequence processing.voidUnblocks pileline computations due to clearing of external blocking reasons.voidUnlocks segments task for the given object.voidValidates pipeline state on pipeline close.
-
Field Details
-
OPERATION_SEGMENTS
-
-
Method Details
-
create
public static AsyncProcessingPipeline create(Collection<DerivedDataSegmentDefinition> segmentDefinitions, Collection<DerivedDataSegmentDefinitionV2> segmentDefinitionsV2, IDerivedDataServiceLockController lockController, String modelId, AsyncPipelineModalModeAccessor modalModeAccessor) Creates an instance of the async derived data processing pipeline- Parameters:
segmentDefinitions- The set of derived data segment definitions. May not benullsegmentDefinitionsV2- The set of V2 derived data segment definitions. May not benulllockController- The lock controller. May not benullmodelId- The identifier of the BM model. May not benull
-
areAllSegmentsComputed
public boolean areAllSegmentsComputed()Description copied from interface:IAsyncProcessingPipelineChecks if all segments are computed.- Specified by:
areAllSegmentsComputedin interfaceIAsyncProcessingPipeline- Returns:
- True if all DD segments are computed.
-
blockPipeline
public void blockPipeline()Description copied from interface:IAsyncProcessingPipelineBlocks pipeline computations due to external reasons.- Specified by:
blockPipelinein interfaceIAsyncProcessingPipeline
-
deactivateContexts
Description copied from interface:IAsyncProcessingPipelineDeactivates contexts of a specified pipeline segment. Deactivated contexts are treated as non-existing(or being removed) unit reactivation- Specified by:
deactivateContextsin interfaceIAsyncProcessingPipeline- Parameters:
segmentId- The target segment of the pipeline to deactivate contexts for. Cannot benull
-
prepareForClose
public void prepareForClose()Description copied from interface:IAsyncProcessingPipelinePrepares the pipeline for the closing. Blocks data/unimportant operation computation leaving the important operation execution intact- Specified by:
prepareForClosein interfaceIAsyncProcessingPipeline
-
validateOnClose
public void validateOnClose()Description copied from interface:IAsyncProcessingPipelineValidates pipeline state on pipeline close. Pipeline shoudn't have any unfinished running tasks- Specified by:
validateOnClosein interfaceIAsyncProcessingPipeline
-
confirm
Description copied from interface:IAsyncProcessingPipelineConfirms processing of the specified context collection.- Specified by:
confirmin interfaceIAsyncProcessingPipeline- Parameters:
segmentId- The segment id, cannot benullobjectId- The object id, cannot benull
-
dumpPipelineState
-
gather
Description copied from interface:IAsyncProcessingPipelineGather next derived data processing task. Pipeline takes all considerations (locking, etc) into consideration while gathering next set of tasks.
Gathering of the tasks locks the next gatherings of this task until the lock will be cleared (as a result of computation confirmation, etc).- Specified by:
gatherin interfaceIAsyncProcessingPipeline- Returns:
- The DD processing task.
-
getCurrentMultiThreadingComputePolicy
Description copied from interface:IAsyncProcessingPipelineGets the multithreading computation policy for the current state of the pipeline.- Specified by:
getCurrentMultiThreadingComputePolicyin interfaceIAsyncProcessingPipeline- Returns:
- The active policy; cannot be null.
-
getCurrentSegmentIds
Description copied from interface:IAsyncProcessingPipelineGets the set of segments the pipeline works on at the moment. As the pipeline supports concurrent computations for grouped segments there are could be several active segments.- Specified by:
getCurrentSegmentIdsin interfaceIAsyncProcessingPipeline- Returns:
- The list of identifiers for current segments. Could be empty only in case if the pipeline configuration is empty.
-
getReadySegments
Description copied from interface:IAsyncProcessingPipelineGets ready (computed) DD segments.- Specified by:
getReadySegmentsin interfaceIAsyncProcessingPipeline
-
getRemainingUnitsOfWork
Description copied from interface:IAsyncProcessingPipelineGets the number of remaining work units for the given segment.- Specified by:
getRemainingUnitsOfWorkin interfaceIAsyncProcessingPipeline- Parameters:
segmentId- The identifier of the segment.- Returns:
- The number of remaining work units in the pipeline of the segment.
-
getSegmentName
Description copied from interface:IAsyncProcessingPipelineGets the human-readable name (localizable) for the given DD segment,- Specified by:
getSegmentNamein interfaceIAsyncProcessingPipeline- Parameters:
segmentId- The identifier of the DD segment.- Returns:
- The human-readable name of the segment.
-
getStatus
Description copied from interface:IAsyncProcessingPipelineGets the current status of the DD async. pipeline.- Specified by:
getStatusin interfaceIAsyncProcessingPipeline- Returns:
- The status of the pipeline.
-
getActivePipelineStatus
Description copied from interface:IAsyncProcessingPipelineGets the current status of the DD async. pipeline. The modal pipeline status is taken into the account- Specified by:
getActivePipelineStatusin interfaceIAsyncProcessingPipeline- Returns:
- The status of the pipeline.
-
getActivePipelineStage
Description copied from interface:IAsyncProcessingPipelineGets the current stage of the DD async. pipeline. The modal pipeline status is taken into the account- Specified by:
getActivePipelineStagein interfaceIAsyncProcessingPipeline- Returns:
- The current stage of the pipeline. May not be
null
-
getActiveStageLock
Description copied from interface:IAsyncProcessingPipelineGets active stage lock (if any)- Specified by:
getActiveStageLockin interfaceIAsyncProcessingPipeline- Returns:
- Active stage lock. Can be
null
-
isBlockedExternally
public boolean isBlockedExternally()Description copied from interface:IAsyncProcessingPipelineChecks if the pipeline is blocked externally- Specified by:
isBlockedExternallyin interfaceIAsyncProcessingPipeline- Returns:
- True if the pipeline is blocked externally
-
getTotalUnitsOfWork
Description copied from interface:IAsyncProcessingPipelineGets the total number of work units for the given DD segment.- Specified by:
getTotalUnitsOfWorkin interfaceIAsyncProcessingPipeline- Parameters:
segmentId- The identifier of the target DD segment.- Returns:
- The total number of work units.
-
hasPriorityTasks
public boolean hasPriorityTasks()Description copied from interface:IAsyncProcessingPipelineChecks if the pipeline has priority tasks ready to be computed at the moment- Specified by:
hasPriorityTasksin interfaceIAsyncProcessingPipeline- Returns:
- True if the pipepilne has priority tasks for the computing at the moment
-
hasRunningComputations
public boolean hasRunningComputations()Description copied from interface:IAsyncProcessingPipelineChecks if the DD subsystem already scheduled some DD tasks for the computation. We need to wait until computations are done in cases of system shutdown, etc.- Specified by:
hasRunningComputationsin interfaceIAsyncProcessingPipeline- Returns:
- True if there are active computations of DD.
-
increasePriority
Description copied from interface:IAsyncProcessingPipelineIncrease priority of all segments being supplied as a scope- Specified by:
increasePriorityin interfaceIAsyncProcessingPipeline
-
increasePriority
Description copied from interface:IAsyncProcessingPipelineIncreases the priority of computation for the given scope- Specified by:
increasePriorityin interfaceIAsyncProcessingPipeline- Parameters:
scope- Identifiers of objects mapped to corresponding segments
-
increasePriority
Description copied from interface:IAsyncProcessingPipelineIncreases the priority of computation for the given BM object in a specified DD segment.- Specified by:
increasePriorityin interfaceIAsyncProcessingPipeline- Parameters:
segmentId- The identifier of the target DD segment.bmObjectId- The identfier of the BM object.
-
inSync
public boolean inSync()Description copied from interface:IAsyncProcessingPipelineChecks if the pipeline performs processing ofDerivedDataSegmentBucket.SYNCstage- Specified by:
inSyncin interfaceIAsyncProcessingPipeline- Returns:
- True if the pipeline performs DD task dispatching during the resource sycnhronization at the moment
-
isLongRunningSegment
Description copied from interface:IAsyncProcessingPipelineChecks if the requested DD segment is a long-running one (so the progress indication should be comprehensible to the user).- Specified by:
isLongRunningSegmentin interfaceIAsyncProcessingPipeline- Parameters:
segmentId- The identifier of the target DD segment.- Returns:
- True if the DD segment is a long running one.
-
isSegmentComputed
Description copied from interface:IAsyncProcessingPipelineChecks if the DD segment is computed completely.- Specified by:
isSegmentComputedin interfaceIAsyncProcessingPipeline- Parameters:
segmentId- The identifier of the target DD segment.- Returns:
- True if the DD segment data is computed for all applicable (and known) objects.
-
remove
Description copied from interface:IAsyncProcessingPipelineRemoves all context from the async. pipeline for the given object (e.g. during removal of the object).- Specified by:
removein interfaceIAsyncProcessingPipeline- Parameters:
objectId- The identifier of the object.
-
removeOperation
Description copied from interface:IAsyncProcessingPipelineRemoves a previously scheduled operation from the pipeline. Does nothing in case if the operation is already removed/computed- Specified by:
removeOperationin interfaceIAsyncProcessingPipeline- Parameters:
handle- The handle of the operation. May not benull
-
renderStatusText
Description copied from interface:IAsyncProcessingPipelineRenders status text for the given segment.- Specified by:
renderStatusTextin interfaceIAsyncProcessingPipeline- Parameters:
currentSegmentId- The identifier of the DD segment.- Returns:
- The human-readable DD segment status.
-
resetStageLock
Description copied from interface:IAsyncProcessingPipelineResets the stage lock, if any- Specified by:
resetStageLockin interfaceIAsyncProcessingPipeline- Parameters:
stage- The stage of the async pipeline to reset the lock. May not benull
-
resetPipelineStatus
public void resetPipelineStatus()Description copied from interface:IAsyncProcessingPipelineRe-sets the pipeline status, pipeline position, etc. The pipeline will re-position itself after that- Specified by:
resetPipelineStatusin interfaceIAsyncProcessingPipeline
-
resetActivePipelineStatus
public void resetActivePipelineStatus()Description copied from interface:IAsyncProcessingPipelineResets the active pipeline status. This method always selects the active pipeline (modal or main) independently of the current thread binding to the modal operation (if any)- Specified by:
resetActivePipelineStatusin interfaceIAsyncProcessingPipeline
-
schedule
public void schedule(Collection<IObjectDerivedDataContext> updatedContexts, Object modalOperationContext) Description copied from interface:IAsyncProcessingPipelineSchedules the updated derived data contexts into the pipeline.- Specified by:
schedulein interfaceIAsyncProcessingPipeline- Parameters:
updatedContexts- Updated contexts.
-
setStageLock
public StageLockRequestResult setStageLock(DerivedDataSegmentBucket stage, boolean allowDataComputing) Description copied from interface:IAsyncProcessingPipelineSets the stage lock for a specified stage of async pipeline. May be called multiple times to check the current status of the lock via the returned value- Specified by:
setStageLockin interfaceIAsyncProcessingPipeline- Parameters:
stage- The stage to lock. May not benullallowDataComputing- Allows parallel computing of data (not operations) in the target stage of the pipeline- Returns:
- The result of locking. Indicates the state of the pipeline at the moment of the lock
-
startMassiveComputing
public void startMassiveComputing()Description copied from interface:IAsyncProcessingPipelineEnables the massive computing mode for the DD pipeline. The mode is being desingaged after computing of all registered important tasks- Specified by:
startMassiveComputingin interfaceIAsyncProcessingPipeline
-
start
Description copied from interface:IAsyncProcessingPipelineStarts a pipeline with additional callbacks required by the computation process- Specified by:
startin interfaceIAsyncProcessingPipeline- Parameters:
unlockNotifier-IAsyncProcessingPipeline.unlock(String, Object)call notifier. May not benull
-
stop
public void stop()Description copied from interface:IAsyncProcessingPipelineStops the pipeline, performing all shutdown sequence processing.- Specified by:
stopin interfaceIAsyncProcessingPipeline
-
unblockPipeline
public void unblockPipeline()Description copied from interface:IAsyncProcessingPipelineUnblocks pileline computations due to clearing of external blocking reasons.- Specified by:
unblockPipelinein interfaceIAsyncProcessingPipeline
-
unlock
Description copied from interface:IAsyncProcessingPipelineUnlocks segments task for the given object.- Specified by:
unlockin interfaceIAsyncProcessingPipeline- Parameters:
segmentId- The DD segment to lock into.objectId- The object which DD task should be unlocked.
-
hasOperation
Description copied from interface:IAsyncProcessingPipelineChecks if the pipeline has a scheduled operation- Specified by:
hasOperationin interfaceIAsyncProcessingPipeline- Parameters:
handle- the operation handle. May not benull- Returns:
- True if the pipeline has scheduled operation matching the given handle
-
markAsModalOperationParticipant
public void markAsModalOperationParticipant()Description copied from interface:IAsyncProcessingPipelineMarks the current thread explicitly as a participant of the modal operation. The mark may/will be reset automatically after the reset of the modal operation- Specified by:
markAsModalOperationParticipantin interfaceIAsyncProcessingPipeline
-
getActiveNonPriorityTasksResetRequiredStage
Description copied from interface:IAsyncProcessingPipelineChecks if a supplier requests a reset of currently computed non-priority tasks (e.g. due to more prioritable operation is appeared)- Specified by:
getActiveNonPriorityTasksResetRequiredStagein interfaceIAsyncProcessingPipeline- Returns:
- Stage to reset non-priority tasks (if any).
nullif not reset is required
-
isOperationActiveInThread
public boolean isOperationActiveInThread()Description copied from interface:IAsyncProcessingPipelineChecks if there is an orchestrated operation being active in the client thread. Modal operations aren't tracked by this method- Specified by:
isOperationActiveInThreadin interfaceIAsyncProcessingPipeline- Returns:
- True if there is an active orchestrated operation wrapping the calling code at the moment
-
registerActiveOperation
Description copied from interface:IAsyncProcessingPipelineRegisters the active operation context for the current thread- Specified by:
registerActiveOperationin interfaceIAsyncProcessingPipeline- Parameters:
context- The operation context to register. May not benull
-
markActiveOperationAsAutoWrapping
public void markActiveOperationAsAutoWrapping()Description copied from interface:IAsyncProcessingPipelineMarks the operation as an auto-wrapping one. This may be done only after scheduling due to requiremend of the DD engine- Specified by:
markActiveOperationAsAutoWrappingin interfaceIAsyncProcessingPipeline
-
completeAutoWrappingOperationIfApplicable
Description copied from interface:IAsyncProcessingPipelineFinishes the auto-wrapping operation if any for the given BM operation handle- Specified by:
completeAutoWrappingOperationIfApplicablein interfaceIAsyncProcessingPipeline- Parameters:
bmOperationHandle- The handle of the executed BM operation. May not benull- Returns:
- The context of the finished operation, if any.
nullotherwise
-
resetActiveWrappingOperationContext
Description copied from interface:IAsyncProcessingPipelineResets the binding of an operation to the current thread- Specified by:
resetActiveWrappingOperationContextin interfaceIAsyncProcessingPipeline- Parameters:
operationContext- The operation context to reset the binding for. May not benull
-
bindTaskToAnActiveOperationIfApplicable
Description copied from interface:IAsyncProcessingPipelineBinds the BM task to the manually created operation- Specified by:
bindTaskToAnActiveOperationIfApplicablein interfaceIAsyncProcessingPipeline- Parameters:
bmOperationHandle- The BM task handle. May not benull
-
disableAutoWrapping
public void disableAutoWrapping()Description copied from interface:IAsyncProcessingPipelineDisables auto-wrapping of BM tasks with operations for the current thread. Used for async data computations being controlled directly by the async pipeline- Specified by:
disableAutoWrappingin interfaceIAsyncProcessingPipeline
-
enableAutoWrapping
public void enableAutoWrapping()Description copied from interface:IAsyncProcessingPipelineEnables an auto-wrapping of BM tasks with orchestrator operations for the current thread. Used to restore an auto-wrapping being disabled previously- Specified by:
enableAutoWrappingin interfaceIAsyncProcessingPipeline
-
getWrappingOperation
Description copied from interface:IAsyncProcessingPipelineGets the current BM task wrapping operation (if any)- Specified by:
getWrappingOperationin interfaceIAsyncProcessingPipeline- Returns:
- The context of the wrapping operation (if any).
nullotherwise
-
setImplicitWaitingContext
Description copied from interface:IAsyncProcessingPipelineSets the implicit waiting context to the current wrapping operation (if any)- Specified by:
setImplicitWaitingContextin interfaceIAsyncProcessingPipeline- Parameters:
changedContexts- The set of changed DD context. May not benull
-