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 TypeMethodDescriptionboolean
Checks if all segments are computed.void
bindTaskToAnActiveOperationIfApplicable
(Object bmOperationHandle) Binds the BM task to the manually created operationvoid
Blocks pipeline computations due to external reasons.completeAutoWrappingOperationIfApplicable
(Object bmOperationHandle) Finishes the auto-wrapping operation if any for the given BM operation handlevoid
Confirms processing of the specified context collection.static AsyncProcessingPipeline
create
(Collection<DerivedDataSegmentDefinition> segmentDefinitions, Collection<DerivedDataSegmentDefinitionV2> segmentDefinitionsV2, IDerivedDataServiceLockController lockController, String modelId, AsyncPipelineModalModeAccessor modalModeAccessor) Creates an instance of the async derived data processing pipelinevoid
deactivateContexts
(String segmentId) Deactivates contexts of a specified pipeline segment.void
Disables auto-wrapping of BM tasks with operations for the current thread.void
dumpPipelineState
(IDerivedDataContextManager contextManager) void
Enables 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.int
getRemainingUnitsOfWork
(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.int
getTotalUnitsOfWork
(String segmentId) Gets the total number of work units for the given DD segment.Gets the current BM task wrapping operation (if any)boolean
hasOperation
(Object handle) Checks if the pipeline has a scheduled operationboolean
Checks if the pipeline has priority tasks ready to be computed at the momentboolean
Checks if the DD subsystem already scheduled some DD tasks for the computation.void
increasePriority
(String segmentId, long bmObjectId) Increases the priority of computation for the given BM object in a specified DD segment.void
increasePriority
(Collection<String> segments) Increase priority of all segments being supplied as a scopevoid
increasePriority
(Map<Object, Collection<String>> scope) Increases the priority of computation for the given scopeboolean
inSync()
Checks if the pipeline performs processing ofDerivedDataSegmentBucket.SYNC
stageboolean
Checks if the pipeline is blocked externallyboolean
isLongRunningSegment
(String segmentId) Checks if the requested DD segment is a long-running one (so the progress indication should be comprehensible to the user).boolean
Checks if there is an orchestrated operation being active in the client thread.boolean
isSegmentComputed
(String segmentId) Checks if the DD segment is computed completely.void
Marks the operation as an auto-wrapping one.void
Marks the current thread explicitly as a participant of the modal operation.void
Prepares the pipeline for the closing.void
registerActiveOperation
(OperationContext context) Registers the active operation context for the current threadvoid
Removes all context from the async. pipeline for the given object (e.g. during removal of the object).void
removeOperation
(Object handle) Removes a previously scheduled operation from the pipeline.renderStatusText
(String currentSegmentId) Renders status text for the given segment.void
Resets the active pipeline status.void
resetActiveWrappingOperationContext
(OperationContext operationContext) Resets the binding of an operation to the current threadvoid
Re-sets the pipeline status, pipeline position, etc.void
Resets the stage lock, if anyvoid
schedule
(Collection<IObjectDerivedDataContext> updatedContexts, Object modalOperationContext) Schedules the updated derived data contexts into the pipeline.void
setImplicitWaitingContext
(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.void
start
(BiConsumer<String, Object> unlockNotifier) Starts a pipeline with additional callbacks required by the computation processvoid
Enables the massive computing mode for the DD pipeline.void
stop()
Stops the pipeline, performing all shutdown sequence processing.void
Unblocks pileline computations due to clearing of external blocking reasons.void
Unlocks segments task for the given object.void
Validates 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 benull
segmentDefinitionsV2
- The set of V2 derived data segment definitions. May not benull
lockController
- The lock controller. May not benull
modelId
- The identifier of the BM model. May not benull
-
areAllSegmentsComputed
public boolean areAllSegmentsComputed()Description copied from interface:IAsyncProcessingPipeline
Checks if all segments are computed.- Specified by:
areAllSegmentsComputed
in interfaceIAsyncProcessingPipeline
- Returns:
- True if all DD segments are computed.
-
blockPipeline
public void blockPipeline()Description copied from interface:IAsyncProcessingPipeline
Blocks pipeline computations due to external reasons.- Specified by:
blockPipeline
in interfaceIAsyncProcessingPipeline
-
deactivateContexts
Description copied from interface:IAsyncProcessingPipeline
Deactivates contexts of a specified pipeline segment. Deactivated contexts are treated as non-existing(or being removed) unit reactivation- Specified by:
deactivateContexts
in interfaceIAsyncProcessingPipeline
- Parameters:
segmentId
- The target segment of the pipeline to deactivate contexts for. Cannot benull
-
prepareForClose
public void prepareForClose()Description copied from interface:IAsyncProcessingPipeline
Prepares the pipeline for the closing. Blocks data/unimportant operation computation leaving the important operation execution intact- Specified by:
prepareForClose
in interfaceIAsyncProcessingPipeline
-
validateOnClose
public void validateOnClose()Description copied from interface:IAsyncProcessingPipeline
Validates pipeline state on pipeline close. Pipeline shoudn't have any unfinished running tasks- Specified by:
validateOnClose
in interfaceIAsyncProcessingPipeline
-
confirm
Description copied from interface:IAsyncProcessingPipeline
Confirms processing of the specified context collection.- Specified by:
confirm
in interfaceIAsyncProcessingPipeline
- Parameters:
segmentId
- The segment id, cannot benull
objectId
- The object id, cannot benull
-
dumpPipelineState
-
gather
Description copied from interface:IAsyncProcessingPipeline
Gather 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:
gather
in interfaceIAsyncProcessingPipeline
- Returns:
- The DD processing task.
-
getCurrentMultiThreadingComputePolicy
Description copied from interface:IAsyncProcessingPipeline
Gets the multithreading computation policy for the current state of the pipeline.- Specified by:
getCurrentMultiThreadingComputePolicy
in interfaceIAsyncProcessingPipeline
- Returns:
- The active policy; cannot be null.
-
getCurrentSegmentIds
Description copied from interface:IAsyncProcessingPipeline
Gets 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:
getCurrentSegmentIds
in 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:IAsyncProcessingPipeline
Gets ready (computed) DD segments.- Specified by:
getReadySegments
in interfaceIAsyncProcessingPipeline
-
getRemainingUnitsOfWork
Description copied from interface:IAsyncProcessingPipeline
Gets the number of remaining work units for the given segment.- Specified by:
getRemainingUnitsOfWork
in 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:IAsyncProcessingPipeline
Gets the human-readable name (localizable) for the given DD segment,- Specified by:
getSegmentName
in interfaceIAsyncProcessingPipeline
- Parameters:
segmentId
- The identifier of the DD segment.- Returns:
- The human-readable name of the segment.
-
getStatus
Description copied from interface:IAsyncProcessingPipeline
Gets the current status of the DD async. pipeline.- Specified by:
getStatus
in interfaceIAsyncProcessingPipeline
- Returns:
- The status of the pipeline.
-
getActivePipelineStatus
Description copied from interface:IAsyncProcessingPipeline
Gets the current status of the DD async. pipeline. The modal pipeline status is taken into the account- Specified by:
getActivePipelineStatus
in interfaceIAsyncProcessingPipeline
- Returns:
- The status of the pipeline.
-
getActivePipelineStage
Description copied from interface:IAsyncProcessingPipeline
Gets the current stage of the DD async. pipeline. The modal pipeline status is taken into the account- Specified by:
getActivePipelineStage
in interfaceIAsyncProcessingPipeline
- Returns:
- The current stage of the pipeline. May not be
null
-
getActiveStageLock
Description copied from interface:IAsyncProcessingPipeline
Gets active stage lock (if any)- Specified by:
getActiveStageLock
in interfaceIAsyncProcessingPipeline
- Returns:
- Active stage lock. Can be
null
-
isBlockedExternally
public boolean isBlockedExternally()Description copied from interface:IAsyncProcessingPipeline
Checks if the pipeline is blocked externally- Specified by:
isBlockedExternally
in interfaceIAsyncProcessingPipeline
- Returns:
- True if the pipeline is blocked externally
-
getTotalUnitsOfWork
Description copied from interface:IAsyncProcessingPipeline
Gets the total number of work units for the given DD segment.- Specified by:
getTotalUnitsOfWork
in 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:IAsyncProcessingPipeline
Checks if the pipeline has priority tasks ready to be computed at the moment- Specified by:
hasPriorityTasks
in interfaceIAsyncProcessingPipeline
- Returns:
- True if the pipepilne has priority tasks for the computing at the moment
-
hasRunningComputations
public boolean hasRunningComputations()Description copied from interface:IAsyncProcessingPipeline
Checks 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:
hasRunningComputations
in interfaceIAsyncProcessingPipeline
- Returns:
- True if there are active computations of DD.
-
increasePriority
Description copied from interface:IAsyncProcessingPipeline
Increase priority of all segments being supplied as a scope- Specified by:
increasePriority
in interfaceIAsyncProcessingPipeline
-
increasePriority
Description copied from interface:IAsyncProcessingPipeline
Increases the priority of computation for the given scope- Specified by:
increasePriority
in interfaceIAsyncProcessingPipeline
- Parameters:
scope
- Identifiers of objects mapped to corresponding segments
-
increasePriority
Description copied from interface:IAsyncProcessingPipeline
Increases the priority of computation for the given BM object in a specified DD segment.- Specified by:
increasePriority
in 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:IAsyncProcessingPipeline
Checks if the pipeline performs processing ofDerivedDataSegmentBucket.SYNC
stage- Specified by:
inSync
in interfaceIAsyncProcessingPipeline
- Returns:
- True if the pipeline performs DD task dispatching during the resource sycnhronization at the moment
-
isLongRunningSegment
Description copied from interface:IAsyncProcessingPipeline
Checks if the requested DD segment is a long-running one (so the progress indication should be comprehensible to the user).- Specified by:
isLongRunningSegment
in 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:IAsyncProcessingPipeline
Checks if the DD segment is computed completely.- Specified by:
isSegmentComputed
in 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:IAsyncProcessingPipeline
Removes all context from the async. pipeline for the given object (e.g. during removal of the object).- Specified by:
remove
in interfaceIAsyncProcessingPipeline
- Parameters:
objectId
- The identifier of the object.
-
removeOperation
Description copied from interface:IAsyncProcessingPipeline
Removes a previously scheduled operation from the pipeline. Does nothing in case if the operation is already removed/computed- Specified by:
removeOperation
in interfaceIAsyncProcessingPipeline
- Parameters:
handle
- The handle of the operation. May not benull
-
renderStatusText
Description copied from interface:IAsyncProcessingPipeline
Renders status text for the given segment.- Specified by:
renderStatusText
in interfaceIAsyncProcessingPipeline
- Parameters:
currentSegmentId
- The identifier of the DD segment.- Returns:
- The human-readable DD segment status.
-
resetStageLock
Description copied from interface:IAsyncProcessingPipeline
Resets the stage lock, if any- Specified by:
resetStageLock
in interfaceIAsyncProcessingPipeline
- Parameters:
stage
- The stage of the async pipeline to reset the lock. May not benull
-
resetPipelineStatus
public void resetPipelineStatus()Description copied from interface:IAsyncProcessingPipeline
Re-sets the pipeline status, pipeline position, etc. The pipeline will re-position itself after that- Specified by:
resetPipelineStatus
in interfaceIAsyncProcessingPipeline
-
resetActivePipelineStatus
public void resetActivePipelineStatus()Description copied from interface:IAsyncProcessingPipeline
Resets 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:
resetActivePipelineStatus
in interfaceIAsyncProcessingPipeline
-
schedule
public void schedule(Collection<IObjectDerivedDataContext> updatedContexts, Object modalOperationContext) Description copied from interface:IAsyncProcessingPipeline
Schedules the updated derived data contexts into the pipeline.- Specified by:
schedule
in interfaceIAsyncProcessingPipeline
- Parameters:
updatedContexts
- Updated contexts.
-
setStageLock
public StageLockRequestResult setStageLock(DerivedDataSegmentBucket stage, boolean allowDataComputing) Description copied from interface:IAsyncProcessingPipeline
Sets 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:
setStageLock
in interfaceIAsyncProcessingPipeline
- Parameters:
stage
- The stage to lock. May not benull
allowDataComputing
- 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:IAsyncProcessingPipeline
Enables the massive computing mode for the DD pipeline. The mode is being desingaged after computing of all registered important tasks- Specified by:
startMassiveComputing
in interfaceIAsyncProcessingPipeline
-
start
Description copied from interface:IAsyncProcessingPipeline
Starts a pipeline with additional callbacks required by the computation process- Specified by:
start
in interfaceIAsyncProcessingPipeline
- Parameters:
unlockNotifier
-IAsyncProcessingPipeline.unlock(String, Object)
call notifier. May not benull
-
stop
public void stop()Description copied from interface:IAsyncProcessingPipeline
Stops the pipeline, performing all shutdown sequence processing.- Specified by:
stop
in interfaceIAsyncProcessingPipeline
-
unblockPipeline
public void unblockPipeline()Description copied from interface:IAsyncProcessingPipeline
Unblocks pileline computations due to clearing of external blocking reasons.- Specified by:
unblockPipeline
in interfaceIAsyncProcessingPipeline
-
unlock
Description copied from interface:IAsyncProcessingPipeline
Unlocks segments task for the given object.- Specified by:
unlock
in interfaceIAsyncProcessingPipeline
- Parameters:
segmentId
- The DD segment to lock into.objectId
- The object which DD task should be unlocked.
-
hasOperation
Description copied from interface:IAsyncProcessingPipeline
Checks if the pipeline has a scheduled operation- Specified by:
hasOperation
in 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:IAsyncProcessingPipeline
Marks 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:
markAsModalOperationParticipant
in interfaceIAsyncProcessingPipeline
-
getActiveNonPriorityTasksResetRequiredStage
Description copied from interface:IAsyncProcessingPipeline
Checks if a supplier requests a reset of currently computed non-priority tasks (e.g. due to more prioritable operation is appeared)- Specified by:
getActiveNonPriorityTasksResetRequiredStage
in interfaceIAsyncProcessingPipeline
- Returns:
- Stage to reset non-priority tasks (if any).
null
if not reset is required
-
isOperationActiveInThread
public boolean isOperationActiveInThread()Description copied from interface:IAsyncProcessingPipeline
Checks if there is an orchestrated operation being active in the client thread. Modal operations aren't tracked by this method- Specified by:
isOperationActiveInThread
in interfaceIAsyncProcessingPipeline
- Returns:
- True if there is an active orchestrated operation wrapping the calling code at the moment
-
registerActiveOperation
Description copied from interface:IAsyncProcessingPipeline
Registers the active operation context for the current thread- Specified by:
registerActiveOperation
in interfaceIAsyncProcessingPipeline
- Parameters:
context
- The operation context to register. May not benull
-
markActiveOperationAsAutoWrapping
public void markActiveOperationAsAutoWrapping()Description copied from interface:IAsyncProcessingPipeline
Marks the operation as an auto-wrapping one. This may be done only after scheduling due to requiremend of the DD engine- Specified by:
markActiveOperationAsAutoWrapping
in interfaceIAsyncProcessingPipeline
-
completeAutoWrappingOperationIfApplicable
Description copied from interface:IAsyncProcessingPipeline
Finishes the auto-wrapping operation if any for the given BM operation handle- Specified by:
completeAutoWrappingOperationIfApplicable
in interfaceIAsyncProcessingPipeline
- Parameters:
bmOperationHandle
- The handle of the executed BM operation. May not benull
- Returns:
- The context of the finished operation, if any.
null
otherwise
-
resetActiveWrappingOperationContext
Description copied from interface:IAsyncProcessingPipeline
Resets the binding of an operation to the current thread- Specified by:
resetActiveWrappingOperationContext
in interfaceIAsyncProcessingPipeline
- Parameters:
operationContext
- The operation context to reset the binding for. May not benull
-
bindTaskToAnActiveOperationIfApplicable
Description copied from interface:IAsyncProcessingPipeline
Binds the BM task to the manually created operation- Specified by:
bindTaskToAnActiveOperationIfApplicable
in interfaceIAsyncProcessingPipeline
- Parameters:
bmOperationHandle
- The BM task handle. May not benull
-
disableAutoWrapping
public void disableAutoWrapping()Description copied from interface:IAsyncProcessingPipeline
Disables 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:
disableAutoWrapping
in interfaceIAsyncProcessingPipeline
-
enableAutoWrapping
public void enableAutoWrapping()Description copied from interface:IAsyncProcessingPipeline
Enables an auto-wrapping of BM tasks with orchestrator operations for the current thread. Used to restore an auto-wrapping being disabled previously- Specified by:
enableAutoWrapping
in interfaceIAsyncProcessingPipeline
-
getWrappingOperation
Description copied from interface:IAsyncProcessingPipeline
Gets the current BM task wrapping operation (if any)- Specified by:
getWrappingOperation
in interfaceIAsyncProcessingPipeline
- Returns:
- The context of the wrapping operation (if any).
null
otherwise
-
setImplicitWaitingContext
Description copied from interface:IAsyncProcessingPipeline
Sets the implicit waiting context to the current wrapping operation (if any)- Specified by:
setImplicitWaitingContext
in interfaceIAsyncProcessingPipeline
- Parameters:
changedContexts
- The set of changed DD context. May not benull
-