Package com._1c.g5.v8.internal.derived
Class DerivedDataManager
java.lang.Object
com._1c.g5.v8.internal.derived.DerivedDataManager
- All Implemented Interfaces:
IContextActivationCallback
,IDerivedDataManager
,IScopeTrackerController
,IComputationTaskManager
,IDerivedDataTaskSupplier
public final class DerivedDataManager
extends Object
implements IDerivedDataManager, IComputationTaskManager, IDerivedDataTaskSupplier, IScopeTrackerController, IContextActivationCallback
Standard implementation of
IDerivedDataManager
interface and
IComputationTaskManager
mix-in.-
Nested Class Summary
Nested classes/interfaces inherited from interface com._1c.g5.v8.internal.derived.scheduler.IDerivedDataTaskSupplier
IDerivedDataTaskSupplier.MultithreadingPolicy, IDerivedDataTaskSupplier.TaskStatus
-
Field Summary
Fields inherited from interface com._1c.g5.v8.derived.IDerivedDataManager
SERVICE_NAME
-
Constructor Summary
ConstructorsConstructorDescriptionDerivedDataManager
(String projectId, IDerivedDataInfoRepository derivedDataInfoRepository, IDerivedDataContextManager contextManager, IContextTransactionManager contextTransactionManager, IDerivedDataServiceLockController lockController, Supplier<Boolean> synchronizationActiveStateSupplier, Collection<DerivedDataSegmentDefinition> segmentDefinitions, Set<String> filteredSegments, IAsyncProcessingPipeline pipeline, Collection<IDerivedDataComputer> computers, Collection<IContextCollector> fullRebuildCollectors, Collection<IRemovalContextCollector> removalCollectors, Collection<IDerivedDataUpdate> restorationUpdates, Collection<IDerivedDataUpdate> forcedDataUpdates) Construct a new instance, performs basic initialization. -
Method Summary
Modifier and TypeMethodDescriptionvoid
activateContexts
(String segmentId) Reactivates collected async computing contexts for a specified segment.void
addObjectStatusListener
(IDerivedDataObjectStatusListener listener, long bmObjectId, String... segments) Adds listener for DD status changes of the given object and set of tracked DD segments.void
addObjectStatusListener
(IDerivedDataObjectStatusListener listener, Map<Long, Collection<String>> scope) Adds listener for DD status changes of the given DD change scope.void
addStatusListener
(IDerivedDataStatusListener listener) Adds listener that will be notified about derived data status changes.void
Applies all forced updates provided byIDerivedDataConfigurationContributor
'svoid
blockAsyncPipeline
(boolean forcedStop) Blocks the async. processing pipeline.void
blockAsyncPipeline
(boolean forcedStop, boolean wait) Blocks the async. processing pipelineboolean
Checks if the supplier has a status change since the last call of this method.void
completeWrappingOperationIfApplicable
(Object bmOperationHandle) Complete implicit wrapping operation if the implicit wrapping operation were started earlier in this threadvoid
deactivateContexts
(String segmentId) Deactivates collected async computing contexts for a specified segmentvoid
Disables auto-wrapping of BM tasks with orchestrator operations for the current thread.void
Disables implicit waiting of the DD independenly of the current system status.void
Dumps current pipeline statevoid
Enables an auto-wrapping of BM tasks with orchestrator operations for the current thread.void
Enables implicit waiting of the DD independenly of the current system status.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 pipeline status of the async. pipeline.Gets the information on the next available task (if any).Gets the current status of DD for the corresponding BM model.Gets the sync event consumer for the integration with the event processing flow ofIBmModel
.Gets the current desired multithreading policy for current set of tasks of this supplier.Gets the next task for the processing.getSegmentName
(String segmentId) Gets the human-readable segment name for the given pipeline segment.Gets the supplier id for easier discrimination by the scheduling facility.getTaskProcessor
(DerivedDataComputationTask computationTask) Gets the processing logic for the given task.void
implicitDerivedDataWait
(Object computationCause) Waits for the derived data computation from the BM task that is wrapped by the implicit/explicit orchestrated operationboolean
Checks if all derived data parts are computed.boolean
isComputed
(long bmObjectId, String segmentId) Checks if the given part is computed for the given BM object.boolean
isComputed
(long bmObjectId, String partId, boolean strict) Checks if the given part is computed for the given BM object.boolean
isComputed
(long bmObjectId, Collection<String> segmentIds) Checks if the given parts are computed for the given BM object.boolean
isComputed
(String... segmentIds) Checks if the given DD segments are computed (if applicable) for all the BM objects.boolean
isComputed
(Collection<String> segmentIds) Checks if the given parts are computed (if applicable) for all the BM objects.boolean
isIdle()
Checks if the computation pipeline is idleboolean
isLongRunningSegment
(String segmentId) Checks if the given async.boolean
Checks if the scope tracking is activevoid
Marks a current thread as a current modal operation participant.void
notifyContextsAreScheduled
(boolean notifyListeners) Notifies the task manager about finishing of the computation or new DD part scheduling.void
Prepares the async. computation facility for closing.void
Processes accumulated DD contexts and update the DD pipeline.void
processUnfinishedCommits
(List<IBmUnfinishedCommitInfo> commitInfo) Processes unfinished commits in case of EDT failure restoration.void
Forces the DD mechanism to recompute all the known parts of all the known objects.void
registerNotificationCallback
(ISchedulerNotificationCallback notificationCallback) DerivedDataTaskScheduler
registers a notification callback on start by calling this method.void
Removes specific DD object status listener instance from the notification chain.void
removeOperation
(Object handle) Removes the previously scheduled operation.void
Removes listener that will be notified about derived data status changes.renderStatusText
(String segmentId) Renders human-readable status of the given async.void
resetActiveWrappingOperationContext
(OperationContext operationContext) Resets the active wrapping operation context associated with the current thread.void
Resets the lock being set earlierscheduleModalOperation
(Consumer<org.eclipse.core.runtime.IProgressMonitor> operation, DerivedDataSegmentBucket stage, IModalOperationController modalOperationController) Schedules the orchestrated modal operation.scheduleOperation
(Consumer<org.eclipse.core.runtime.IProgressMonitor> operation, OperationType operationType, boolean important, DerivedDataSegmentBucket stage) Schedules the orchestrated operation.setStageLock
(DerivedDataSegmentBucket stage, boolean allowDataComputing) Locks the async. pipeline stage (to support manual operations with external pipeline state control).void
start
(IBmModel bmModel, BiConsumer<BmEvent, Boolean> bmEventConsumer) Starts task preparation process.void
Enables the massive computing mode for the DD pipeline.void
startWrappingOperationIfNesessary
(Object bmOperationHandle) Starts implicit wrapping operation for the specifiedIBmTask
in this thread in case if no operation is manually started alreadyvoid
stop()
Stops task preparation process.void
supplyImplicitOperationContextIfApplicable
(Object computationCause, Runnable asyncEventScheduler) Computes synchronous derived data pending for the current session (if any).void
Tries to unblock the supplier, if blockedvoid
unblockAsyncPipeline
(boolean forcedStop) Force unblocking of the async. pipeline.boolean
updateDerivedData
(IDerivedDataUpdate update, long waitTimeout, Object computationCause) Updates derivided data using the providedIDerivedDataUpdate
updateboolean
updateDerviedData
(IDerivedDataUpdate update, long waitTimeout) Updates derivided data using the providedIDerivedDataUpdate
updateboolean
waitAllComputations
(long timeout) Wait till all computations are finished or waiting time exceeds the specified value.boolean
waitComputation
(long timeout, boolean priority, String... scope) Waits completion of the given scopevoid
waitComputation
(Map<Long, Collection<String>> scope) Waits till the given scope of computations is finished.boolean
waitComputation
(Map<Long, Collection<String>> scope, long timeout) Waits till the given scope of computations is finished or waiting time exceeds the specified value.boolean
waitComputationExt
(Map<Object, Collection<String>> scope, long timeout) Waits till the given scope of computations is finished or waiting time exceeds the specified value.boolean
waitImportantDataComputations
(long timeout) Waits all important DD's to be computed.boolean
waitOperationComputation
(Object handle, long timeout) Waits the given operation computation
-
Constructor Details
-
DerivedDataManager
public DerivedDataManager(String projectId, IDerivedDataInfoRepository derivedDataInfoRepository, IDerivedDataContextManager contextManager, IContextTransactionManager contextTransactionManager, IDerivedDataServiceLockController lockController, Supplier<Boolean> synchronizationActiveStateSupplier, Collection<DerivedDataSegmentDefinition> segmentDefinitions, Set<String> filteredSegments, IAsyncProcessingPipeline pipeline, Collection<IDerivedDataComputer> computers, Collection<IContextCollector> fullRebuildCollectors, Collection<IRemovalContextCollector> removalCollectors, Collection<IDerivedDataUpdate> restorationUpdates, Collection<IDerivedDataUpdate> forcedDataUpdates) Construct a new instance, performs basic initialization.- Parameters:
projectId
- The unique identifier of the DT project. May not benull
derivedDataInfoRepository
- The repository to persistderived data info
. May not benull
.contextManager
- Thederived data context
manager. May not benull
.contextTransactionManager
- The DD context operation facility. May not benull
.lockController
- The external derived data calculation lock controlling service. May not benull
.segmentDefinitions
- A collection ofsegment definitions
. May not benull
.filteredSegments
- The set of segment ids that should be ommitted during the computation. May not benull
. May be emptypipeline
- The processing pipeline for asynchronous derived data. May not benull
.computers
- A collection ofcomputers
. May not benull
.fullRebuildCollectors
- A collection offull rebuild collectors
. May not benull
.removalCollectors
- A collection ofremoval collectors
. May not benull
.restorationUpdates
- A collection ofrestoration update scenarios
. May not benull
.forcedDataUpdates
- A collection offorced data update scenarios
. May not benull
.
-
-
Method Details
-
addObjectStatusListener
public void addObjectStatusListener(IDerivedDataObjectStatusListener listener, long bmObjectId, String... segments) Description copied from interface:IDerivedDataManager
Adds listener for DD status changes of the given object and set of tracked DD segments.- Specified by:
addObjectStatusListener
in interfaceIDerivedDataManager
- Parameters:
listener
- The listener instance. Cannot benull
. One can re-use the same instance of the listener to subscribe for different sets of objects and segments, but in this case the call to theIDerivedDataManager.removeObjectStatusListener(com._1c.g5.v8.derived.IDerivedDataObjectStatusListener)
will remove all subscriptions.bmObjectId
- The identifier of the object which DD changes are being notified via the supplied listener. Cannot benull
or empty due to performance reasons. To track down computation of the entire DD segment useIDerivedDataManager#addStatusListener(IDerivedDataStatusListener)
instead}.segments
- DD segment filter allows to subscribe for specific segments of DD. Cannot benull
-
addObjectStatusListener
public void addObjectStatusListener(IDerivedDataObjectStatusListener listener, Map<Long, Collection<String>> scope) Description copied from interface:IDerivedDataManager
Adds listener for DD status changes of the given DD change scope. The scope is defined as a map of BM object identifiers to the respective traked DD segments.- Specified by:
addObjectStatusListener
in interfaceIDerivedDataManager
- Parameters:
listener
- The listener instance. Cannot benull
. One can re-use the same instance of the listener to subscribe for different sets of objects and segments, but in this case the call to theIDerivedDataManager.removeObjectStatusListener(com._1c.g5.v8.derived.IDerivedDataObjectStatusListener)
will remove all subscriptions.scope
- Tracked DD segments mapped to corresponding BM object ids. Cannot benull
. Scope entries cannot containnull
or empty sets of tracked DD segments.
-
addStatusListener
Description copied from interface:IDerivedDataManager
Adds listener that will be notified about derived data status changes.- Specified by:
addStatusListener
in interfaceIDerivedDataManager
- Parameters:
listener
- the listener that should be notified
-
blockAsyncPipeline
public void blockAsyncPipeline(boolean forcedStop) Description copied from interface:IDerivedDataManager
Blocks the async. processing pipeline. This methods waits until all current DD operations are finished before return from the call.- Specified by:
blockAsyncPipeline
in interfaceIDerivedDataManager
- Parameters:
forcedStop
- Locks pipeline in forced mode. In case if true, could be unlocked only with corresponding value of the flag. Forced lock is being used to prevent file sycnhronization opearions/etc to remove manually defined locks.
-
blockAsyncPipeline
public void blockAsyncPipeline(boolean forcedStop, boolean wait) Description copied from interface:IDerivedDataManager
Blocks the async. processing pipeline- Specified by:
blockAsyncPipeline
in interfaceIDerivedDataManager
- Parameters:
forcedStop
- Locks pipeline in forced mode. In case if true, could be unlocked only with corresponding value of the flag. Forced lock is being used to prevent file sycnhronization opearions/etc to remove manually defined locks.wait
- Wait until all running operations in the current pipeline are completed
-
prepareForClose
public void prepareForClose()Description copied from interface:IDerivedDataManager
Prepares the async. computation facility for closing. Blocks all unnecessary data computations and scheduled operations and waits until all required computations are done- Specified by:
prepareForClose
in interfaceIDerivedDataManager
-
disableImplicitWaiting
public void disableImplicitWaiting()Description copied from interface:IDerivedDataManager
Disables implicit waiting of the DD independenly of the current system status. Used during the explicitely managed operations, like merging, etc.- Specified by:
disableImplicitWaiting
in interfaceIDerivedDataManager
-
enableImplicitWaiting
public void enableImplicitWaiting()Description copied from interface:IDerivedDataManager
Enables implicit waiting of the DD independenly of the current system status. Used during the explicitely managed operations, like merging, etc.- Specified by:
enableImplicitWaiting
in interfaceIDerivedDataManager
-
getAsyncPipelineStatus
Gets the current pipeline status of the async. pipeline.- Specified by:
getAsyncPipelineStatus
in interfaceIComputationTaskManager
- Returns:
- The status of the pipeline.
-
getAvailableTaskStatus
Description copied from interface:IDerivedDataTaskSupplier
Gets the information on the next available task (if any).- Specified by:
getAvailableTaskStatus
in interfaceIDerivedDataTaskSupplier
- Returns:
- The task status for a next available task. Never
null
-
getDerivedDataStatus
Description copied from interface:IDerivedDataManager
Gets the current status of DD for the corresponding BM model.- Specified by:
getDerivedDataStatus
in interfaceIDerivedDataManager
- Returns:
- The overall status of the DD facility.
-
isIdle
public boolean isIdle()Description copied from interface:IDerivedDataManager
Checks if the computation pipeline is idle- Specified by:
isIdle
in interfaceIDerivedDataManager
- Returns:
- True if no computations are done/possible at the moment
-
getActiveNonPriorityTasksResetRequiredStage
Description copied from interface:IDerivedDataTaskSupplier
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 interfaceIDerivedDataTaskSupplier
- Returns:
- Stage to reset non-priority tasks (if any).
null
if not reset is required
-
getMultithreadingPolicy
Description copied from interface:IDerivedDataTaskSupplier
Gets the current desired multithreading policy for current set of tasks of this supplier.- Specified by:
getMultithreadingPolicy
in interfaceIDerivedDataTaskSupplier
- Returns:
- Gets the current policy. Cannot be
null
-
getNextTask
Description copied from interface:IDerivedDataTaskSupplier
Gets the next task for the processing. It's not required(yet recommended) for implementations to ensure the integrity of the task info request and task request. So it's possible for the task to disappear or change the priority during the call of theIDerivedDataTaskSupplier.getAvailableTaskStatus()
and subsequent call of this method- Specified by:
getNextTask
in interfaceIDerivedDataTaskSupplier
- Returns:
- The next task if available. Can be
null
in case if the state was changed since the last call of theIDerivedDataTaskSupplier.getAvailableTaskStatus()
-
getSegmentName
Description copied from interface:IComputationTaskManager
Gets the human-readable segment name for the given pipeline segment.- Specified by:
getSegmentName
in interfaceIComputationTaskManager
- Parameters:
segmentId
- The identifier of the target segment.- Returns:
- The the name of the segment.
-
getSupplierId
Description copied from interface:IDerivedDataTaskSupplier
Gets the supplier id for easier discrimination by the scheduling facility. The identifier should be unique in the current session of the EDT- Specified by:
getSupplierId
in interfaceIDerivedDataTaskSupplier
- Returns:
- The supplier identifier. Cannot be
null
-
getTaskProcessor
Description copied from interface:IDerivedDataTaskSupplier
Gets the processing logic for the given task. It's up to this logic to perform any processing/notifications during the DD computation process- Specified by:
getTaskProcessor
in interfaceIDerivedDataTaskSupplier
- Parameters:
computationTask
- The computation task, cannot benull
- Returns:
- The
ITaskProcessor
which is able to perform the DD computation for this task. Cannot benull
-
isAllComputed
public boolean isAllComputed()Description copied from interface:IDerivedDataManager
Checks if all derived data parts are computed.- Specified by:
isAllComputed
in interfaceIDerivedDataManager
- Returns:
true
if computed,false
otherwise
-
isComputed
Description copied from interface:IDerivedDataManager
Checks if the given parts are computed (if applicable) for all the BM objects.- Specified by:
isComputed
in interfaceIDerivedDataManager
- Returns:
true
if computed,false
otherwise
-
isComputed
Checks if the given parts are computed for the given BM object.- Specified by:
isComputed
in interfaceIDerivedDataManager
- Parameters:
bmObjectId
- the ID of the BM object to check- Returns:
true
if computed,false
otherwise
-
isComputed
Description copied from interface:IDerivedDataManager
Checks if the given part is computed for the given BM object.- Specified by:
isComputed
in interfaceIDerivedDataManager
- Parameters:
bmObjectId
- the ID of the BM object to checksegmentId
- the ID of the part to check- Returns:
true
if computed,false
otherwise
-
isComputed
Description copied from interface:IDerivedDataManager
Checks if the given part is computed for the given BM object.- Specified by:
isComputed
in interfaceIDerivedDataManager
- Parameters:
bmObjectId
- the ID of the BM object to checkpartId
- the ID of the part to checkstrict
- In strict mode caller expecting, that part must be calculated. In case if part is still not indicated, the method will return false- Returns:
true
if computed,false
otherwise
-
isComputed
Description copied from interface:IDerivedDataManager
Checks if the given DD segments are computed (if applicable) for all the BM objects.- Specified by:
isComputed
in interfaceIDerivedDataManager
- Parameters:
segmentIds
- Array of the DD segment Ids to check- Returns:
true
if computed,false
otherwise
-
isLongRunningSegment
Description copied from interface:IComputationTaskManager
Checks if the given async. DD segment is a long-running one.- Specified by:
isLongRunningSegment
in interfaceIComputationTaskManager
- Parameters:
segmentId
- The target segment identifier.- Returns:
- True if the segment is long-running one; false otherwise.
-
notifyContextsAreScheduled
public void notifyContextsAreScheduled(boolean notifyListeners) Description copied from interface:IComputationTaskManager
Notifies the task manager about finishing of the computation or new DD part scheduling.- Specified by:
notifyContextsAreScheduled
in interfaceIComputationTaskManager
- Parameters:
notifyListeners
- Notify task listeners.
-
processUnfinishedCommits
Processes unfinished commits in case of EDT failure restoration.- Parameters:
commitInfo
- The list of commit data records that need to be processed. Cannot benull
-
applyForcedUpdates
public void applyForcedUpdates()Description copied from interface:IDerivedDataManager
Applies all forced updates provided byIDerivedDataConfigurationContributor
's- Specified by:
applyForcedUpdates
in interfaceIDerivedDataManager
-
recomputeAll
public void recomputeAll()Description copied from interface:IDerivedDataManager
Forces the DD mechanism to recompute all the known parts of all the known objects.- Specified by:
recomputeAll
in interfaceIDerivedDataManager
-
registerNotificationCallback
Description copied from interface:IDerivedDataTaskSupplier
DerivedDataTaskScheduler
registers a notification callback on start by calling this method. The provided callback should be used to notify scheduler about the availability of a new task. This API is used to increase the operativeness of the DD computations during the normal interractions with the EDT. Provided callback is fully controlled by the dispatcher, the clinet shouldn't pay any specific attention to its lifecycle- Specified by:
registerNotificationCallback
in interfaceIDerivedDataTaskSupplier
- Parameters:
notificationCallback
- The callback from theDerivedDataTaskScheduler
, cannot benull
-
removeObjectStatusListener
Description copied from interface:IDerivedDataManager
Removes specific DD object status listener instance from the notification chain. All subscriptions of the given listener instance will be removed as a result.- Specified by:
removeObjectStatusListener
in interfaceIDerivedDataManager
- Parameters:
listener
- The listener that should be removed. Cannot benull
.
-
removeStatusListener
Description copied from interface:IDerivedDataManager
Removes listener that will be notified about derived data status changes.- Specified by:
removeStatusListener
in interfaceIDerivedDataManager
- Parameters:
listener
- the listener that should be removed.
-
renderStatusText
Renders human-readable status of the given async. DD pipeline segment.- Specified by:
renderStatusText
in interfaceIComputationTaskManager
- Parameters:
segmentId
- The identifier of the taget segment.- Returns:
- The rendered status of the pipeline segment.
-
start
Starts task preparation process.- Parameters:
bmModel
-bmRawEventHandler
-
-
stop
public void stop()Stops task preparation process. -
unblockAsyncPipeline
public void unblockAsyncPipeline(boolean forcedStop) Description copied from interface:IDerivedDataManager
Force unblocking of the async. pipeline. Could stay blocked after the call of this method if async. DD computation prerequisites are not met yet.- Specified by:
unblockAsyncPipeline
in interfaceIDerivedDataManager
- Parameters:
forcedStop
- Unblocks the forced block in case if true. Unblocks usual lock instead.
-
updateDerviedData
Description copied from interface:IDerivedDataManager
Updates derivided data using the providedIDerivedDataUpdate
update- Specified by:
updateDerviedData
in interfaceIDerivedDataManager
- Parameters:
update
- The update to performwaitTimeout
- Waiting time (in milliseconds) for the updated DD to be re-computed; 0 means no wait- Returns:
- True if the requested DD were computed until the end of the waiting period; false otherwise
-
updateDerivedData
public boolean updateDerivedData(IDerivedDataUpdate update, long waitTimeout, Object computationCause) Description copied from interface:IDerivedDataManager
Updates derivided data using the providedIDerivedDataUpdate
update- Specified by:
updateDerivedData
in interfaceIDerivedDataManager
- Parameters:
update
- The update to performwaitTimeout
- Waiting time (in milliseconds) for the updated DD to be scheduled in the pipelinecomputationCause
- The designator of operation or service which caused the update. May benull
- Returns:
- True if the requested DD were computed until the end of the waiting period; false otherwise
-
supplyImplicitOperationContextIfApplicable
public void supplyImplicitOperationContextIfApplicable(Object computationCause, Runnable asyncEventScheduler) throws InterruptedException Description copied from interface:IDerivedDataManager
Computes synchronous derived data pending for the current session (if any). The computation is synchronous.- Specified by:
supplyImplicitOperationContextIfApplicable
in interfaceIDerivedDataManager
- Parameters:
computationCause
- The object bound to the computation context and used to track computations. Can benull
- Throws:
InterruptedException
-
implicitDerivedDataWait
Description copied from interface:IDerivedDataManager
Waits for the derived data computation from the BM task that is wrapped by the implicit/explicit orchestrated operation- Specified by:
implicitDerivedDataWait
in interfaceIDerivedDataManager
- Parameters:
computationCause
- The cause of the computation. May not beNullPointerException
- Throws:
InterruptedException
-
waitAllComputations
Description copied from interface:IDerivedDataManager
Wait till all computations are finished or waiting time exceeds the specified value.- Specified by:
waitAllComputations
in interfaceIDerivedDataManager
- Parameters:
timeout
- the maximum time to wait in milliseconds- Returns:
true
if all derived data has been computed by the time this method returns,false
otherwise- Throws:
InterruptedException
- if any thread interrupted the current thread before or while the current thread was waiting for the computations.
-
waitComputation
public boolean waitComputation(long timeout, boolean priority, String... scope) throws InterruptedException Description copied from interface:IDerivedDataManager
Waits completion of the given scope- Specified by:
waitComputation
in interfaceIDerivedDataManager
- Parameters:
timeout
- The wait timeoutpriority
- The data that is being waited are priority computationsscope
- The scope (parts) to wait- Returns:
- True if the wait was successful; false if it was timed out
- Throws:
InterruptedException
-
waitComputation
Description copied from interface:IDerivedDataManager
Waits till the given scope of computations is finished.- Specified by:
waitComputation
in interfaceIDerivedDataManager
- Parameters:
scope
- the scope of computations to wait for. The scope is a map, where the keys are BM objects whose derived data parts must be computed and the values are collections of the part IDs- Throws:
InterruptedException
- if any thread interrupted the current thread before or while the current thread was waiting for the computation
-
waitComputation
public boolean waitComputation(Map<Long, Collection<String>> scope, long timeout) throws InterruptedExceptionDescription copied from interface:IDerivedDataManager
Waits till the given scope of computations is finished or waiting time exceeds the specified value.- Specified by:
waitComputation
in interfaceIDerivedDataManager
- Parameters:
scope
- the scope of computations to wait for. The scope is a map, where the keys are BM objects whose derived data parts must be computed and the values are collections of the part IDstimeout
- the maximum time to wait in milliseconds- Returns:
true
if the given scope has been computed by the time this method returns,false
otherwise- Throws:
InterruptedException
- if any thread interrupted the current thread before or while the current thread was waiting for the computation.
-
waitOperationComputation
Description copied from interface:IDerivedDataManager
Waits the given operation computation- Specified by:
waitOperationComputation
in interfaceIDerivedDataManager
- Parameters:
handle
- The operation computation handle. May not beNullPointerException
timeout
- the maximum time to wait in milliseconds- Returns:
true
if the given scope has been computed by the time this method returns,false
otherwise- Throws:
InterruptedException
- if any thread interrupted the current thread before or while the current thread was waiting for the computation.
-
waitComputationExt
public boolean waitComputationExt(Map<Object, Collection<String>> scope, long timeout) throws InterruptedExceptionDescription copied from interface:IDerivedDataManager
Waits till the given scope of computations is finished or waiting time exceeds the specified value.- Specified by:
waitComputationExt
in interfaceIDerivedDataManager
- Parameters:
scope
- the scope of computations to wait for. The scope is a map, where the keys are BM objects whose derived data parts must be computed and the values are collections of the part IDstimeout
- the maximum time to wait in milliseconds- Returns:
true
if the given scope has been computed by the time this method returns,false
otherwise- Throws:
InterruptedException
- if any thread interrupted the current thread before or while the current thread was waiting for the computation.
-
waitImportantDataComputations
Description copied from interface:IDerivedDataManager
Waits all important DD's to be computed. The rule to select important DD's is the following:
- All data from
DerivedDataSegmentBucket.SYNC
bucket - All data from
DerivedDataSegmentBucket.AFTER_SYNC
bucket - All data from
DerivedDataSegmentBucket.NORMAL
bucket having a priority greater thenDerivedDataSegmentDefinition.LOW_PRIORITY
- Specified by:
waitImportantDataComputations
in interfaceIDerivedDataManager
- Parameters:
timeout
- the maximum time to wait in milliseconds- Returns:
true
if all derived data has been computed by the time this method returns,false
otherwise- Throws:
InterruptedException
- if any thread interrupted the current thread before or while the current thread was waiting for the computations.
- All data from
-
processAccumulatedContexts
public void processAccumulatedContexts()Description copied from interface:IDerivedDataTaskSupplier
Processes accumulated DD contexts and update the DD pipeline. This method is not thread safe, the caller should guarantee the calls synchronization to ensure the propert order of accumulated context application- Specified by:
processAccumulatedContexts
in interfaceIDerivedDataTaskSupplier
-
checkStatusChange
public boolean checkStatusChange()Description copied from interface:IDerivedDataTaskSupplier
Checks if the supplier has a status change since the last call of this method. The call should reset the change status of the supplier.\n The status change is used to re-check blocked suppliers, as they could be unblocked as a result of this status change- Specified by:
checkStatusChange
in interfaceIDerivedDataTaskSupplier
- Returns:
- True if there is a status change since the last call of this method
-
tryToUnblock
public void tryToUnblock()Description copied from interface:IDerivedDataTaskSupplier
Tries to unblock the supplier, if blocked- Specified by:
tryToUnblock
in interfaceIDerivedDataTaskSupplier
-
startMassiveComputing
public void startMassiveComputing()Description copied from interface:IDerivedDataManager
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 interfaceIDerivedDataManager
-
scheduleOperation
public Object scheduleOperation(Consumer<org.eclipse.core.runtime.IProgressMonitor> operation, OperationType operationType, boolean important, DerivedDataSegmentBucket stage) Description copied from interface:IDerivedDataManager
Schedules the orchestrated operation.- Specified by:
scheduleOperation
in interfaceIDerivedDataManager
- Parameters:
operation
- The operation logic to schedule. May not benull
operationType
- The type of the operation. May not benull
important
- The designator of an important operation. The system waits for important operations computation during closing of projects, etcstage
- The target stage for the scheduling. May not benull
- Returns:
- The operation handle for external operation referencing, may not be
null
-
scheduleModalOperation
public Object scheduleModalOperation(Consumer<org.eclipse.core.runtime.IProgressMonitor> operation, DerivedDataSegmentBucket stage, IModalOperationController modalOperationController) Description copied from interface:IDerivedDataManager
Schedules the orchestrated modal operation. SeeOperationType.MODAL
for details- Specified by:
scheduleModalOperation
in interfaceIDerivedDataManager
- Parameters:
operation
- The operation logic to schedule. May not benull
stage
- The target stage for the scheduling. May not benull
modalOperationController
- The modal operation controller. May not benull
- Returns:
- The operation handle for external operation referencing, may not be
null
-
setStageLock
public StageLockRequestResult setStageLock(DerivedDataSegmentBucket stage, boolean allowDataComputing) Description copied from interface:IDerivedDataManager
Locks the async. pipeline stage (to support manual operations with external pipeline state control). Locked bucket tasks are being computed yet the pipeline can't switch to the next stage. The pre-set lock is being activated only after switching of the pipeline to the target stage. Before the activation the lock doesn't affect the computation.- Specified by:
setStageLock
in interfaceIDerivedDataManager
- Parameters:
stage
- The stage to lock. May not benull
- Returns:
- The status of a target stage at the moment of a lock call. May not be
null
-
resetStageLock
Description copied from interface:IDerivedDataManager
Resets the lock being set earlier- Specified by:
resetStageLock
in interfaceIDerivedDataManager
- Parameters:
stage
- The stage to re-set the bucket. May not benull
. If block isn't set - does nothing.
-
removeOperation
Description copied from interface:IDerivedDataManager
Removes the previously scheduled operation. Does nothing if the operation is already removed/computed- Specified by:
removeOperation
in interfaceIDerivedDataManager
- Parameters:
handle
- The operation handle taken from theIDerivedDataManager#scheduleOperation(Consumer, OperationType, DerivedDataSegmentBucket)
call. May not be null.
-
markAsModalOperationParticipant
public void markAsModalOperationParticipant()Description copied from interface:IDerivedDataManager
Marks a current thread as a current modal operation participant. The mark is removed automatically on the completion of the corresponding modal operation- Specified by:
markAsModalOperationParticipant
in interfaceIDerivedDataManager
-
startWrappingOperationIfNesessary
Description copied from interface:IDerivedDataManager
Starts implicit wrapping operation for the specifiedIBmTask
in this thread in case if no operation is manually started already- Specified by:
startWrappingOperationIfNesessary
in interfaceIDerivedDataManager
- Parameters:
bmOperationHandle
- The BM operation handle to wrap with the orchestrated operation. May not benull
-
completeWrappingOperationIfApplicable
Description copied from interface:IDerivedDataManager
Complete implicit wrapping operation if the implicit wrapping operation were started earlier in this thread- Specified by:
completeWrappingOperationIfApplicable
in interfaceIDerivedDataManager
- Parameters:
bmOperationHandle
- The BM operation handle to wrap with the orchestrated operation. May not benull
-
resetActiveWrappingOperationContext
Description copied from interface:IDerivedDataManager
Resets the active wrapping operation context associated with the current thread.- Specified by:
resetActiveWrappingOperationContext
in interfaceIDerivedDataManager
- Parameters:
operationContext
- The context to reset. May not benull
-
getEventConsumer
Description copied from interface:IDerivedDataManager
Gets the sync event consumer for the integration with the event processing flow ofIBmModel
. Also it's possible to supply BM events directly to the consumer in complex scenarios of managed data updates- Specified by:
getEventConsumer
in interfaceIDerivedDataManager
- Returns:
- The DD
BmEvent
consumer. May not benull
-
disableAutoWrapping
public void disableAutoWrapping()Description copied from interface:IDerivedDataManager
Disables auto-wrapping of BM tasks with orchestrator operations for the current thread. Used for async data computations being controlled directly by the async pipeline. The disablement stays on during the whole thread lifecycle- Specified by:
disableAutoWrapping
in interfaceIDerivedDataManager
-
enableAutoWrapping
public void enableAutoWrapping()Description copied from interface:IDerivedDataManager
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 interfaceIDerivedDataManager
-
isScopeTrackingActive
public boolean isScopeTrackingActive()Description copied from interface:IScopeTrackerController
Checks if the scope tracking is active- Specified by:
isScopeTrackingActive
in interfaceIScopeTrackerController
- Returns:
- True if the scope tracking is active
-
deactivateContexts
Description copied from interface:IContextActivationCallback
Deactivates collected async computing contexts for a specified segment- Specified by:
deactivateContexts
in interfaceIContextActivationCallback
- Parameters:
segmentId
- The async computing pipeline segment. Cannot benull
-
activateContexts
Description copied from interface:IContextActivationCallback
Reactivates collected async computing contexts for a specified segment. Do nothing if contexts were not deactivated earlier- Specified by:
activateContexts
in interfaceIContextActivationCallback
- Parameters:
segmentId
- The async computing pipeline segment. Cannot benull
-
dumpPipeline
public void dumpPipeline()Description copied from interface:IDerivedDataManager
Dumps current pipeline state- Specified by:
dumpPipeline
in interfaceIDerivedDataManager
-