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