Package com._1c.g5.v8.derived
Interface IDerivedDataManager
-
public interface IDerivedDataManager
Derived data manager is responsible for providing clients with the unified access to the DD management functionality, including status tracking.
-
-
Field Summary
Fields Modifier and Type Field Description static String
SERVICE_NAME
Service name for recovery orchestrator
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description 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
applyForcedUpdates()
Applies all forced updates provided byIDerivedDataConfigurationContributor
'svoid
blockAsyncPipeline(boolean forcedStop)
Blocks the async.void
blockAsyncPipeline(boolean forcedStop, boolean wait)
Blocks the async.void
completeWrappingOperationIfApplicable(Object bmOperationHandle)
Complete implicit wrapping operation if the implicit wrapping operation were started earlier in this threadvoid
disableImplicitWaiting()
Disables implicit waiting of the DD independenly of the current system status.void
enableImplicitWaiting()
Enables implicit waiting of the DD independenly of the current system status.DerivedDataStatus
getDerivedDataStatus()
Gets the current status of DD for the corresponding BM model.Consumer<BmEvent>
getEventConsumer()
Gets the sync event consumer for the integration with the event processing flow ofIBmModel
void
implicitDerivedDataWait(Object computationCause)
Waits for the derived data computation from the BM task that is wrapped by the implicit/explicit orchestrated operationboolean
isAllComputed()
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 idlevoid
markAsModalOperationParticipant()
Marks a current thread as a current modal operation participant.void
prepareForClose()
Prepares the async.void
recomputeAll()
Forces the DD mechanism to recompute all the known parts of all the known objects.void
removeObjectStatusListener(IDerivedDataObjectStatusListener listener)
Removes specific DD object status listener instance from the notification chain.void
removeOperation(Object handle)
Removes the previously scheduled operation.void
removeStatusListener(IDerivedDataStatusListener listener)
Removes listener that will be notified about derived data status changes.void
resetActiveWrappingOperationContext(OperationContext operationContext)
Resets the active wrapping operation context associated with the current thread.void
resetStageLock(DerivedDataSegmentBucket stage)
Resets the lock being set earlierObject
scheduleModalOperation(Consumer<org.eclipse.core.runtime.IProgressMonitor> operation, DerivedDataSegmentBucket stage, IModalOperationController modalOperationController)
Schedules the orchestrated modal operation.Object
scheduleOperation(Consumer<org.eclipse.core.runtime.IProgressMonitor> operation, OperationType operationType, boolean important, DerivedDataSegmentBucket stage)
Schedules the orchestrated operation.StageLockRequestResult
setStageLock(DerivedDataSegmentBucket stage, boolean allowDataComputing)
Locks the async.void
startMassiveComputing()
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
supplyImplicitOperationContextIfApplicable(Object computationCause, Runnable asyncEventScheduler)
Computes synchronous derived data pending for the current session (if any).void
unblockAsyncPipeline(boolean forcedStop)
Force unblocking of the async.boolean
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
-
-
-
Field Detail
-
SERVICE_NAME
static final String SERVICE_NAME
Service name for recovery orchestrator- See Also:
- Constant Field Values
-
-
Method Detail
-
addObjectStatusListener
void addObjectStatusListener(IDerivedDataObjectStatusListener listener, long bmObjectId, String... segments)
Adds listener for DD status changes of the given object and set of tracked DD segments.- 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 theremoveObjectStatusListener(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
void addObjectStatusListener(IDerivedDataObjectStatusListener listener, Map<Long,Collection<String>> scope)
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.- 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 theremoveObjectStatusListener(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
void addStatusListener(IDerivedDataStatusListener listener)
Adds listener that will be notified about derived data status changes.- Parameters:
listener
- the listener that should be notified
-
blockAsyncPipeline
void blockAsyncPipeline(boolean forcedStop)
Blocks the async. processing pipeline. This methods waits until all current DD operations are finished before return from the call.- 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
void blockAsyncPipeline(boolean forcedStop, boolean wait)
Blocks the async. processing pipeline- 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
-
disableImplicitWaiting
void disableImplicitWaiting()
Disables implicit waiting of the DD independenly of the current system status. Used during the explicitely managed operations, like merging, etc.
-
enableImplicitWaiting
void enableImplicitWaiting()
Enables implicit waiting of the DD independenly of the current system status. Used during the explicitely managed operations, like merging, etc.
-
getDerivedDataStatus
DerivedDataStatus getDerivedDataStatus()
Gets the current status of DD for the corresponding BM model.- Returns:
- The overall status of the DD facility.
-
isAllComputed
boolean isAllComputed()
Checks if all derived data parts are computed.- Returns:
true
if computed,false
otherwise
-
isComputed
boolean isComputed(Collection<String> segmentIds)
Checks if the given parts are computed (if applicable) for all the BM objects.- Parameters:
partIds
- the IDs of the parts to check- Returns:
true
if computed,false
otherwise
-
isComputed
boolean isComputed(long bmObjectId, Collection<String> segmentIds)
Checks if the given parts are computed for the given BM object.- Parameters:
bmObjectId
- the ID of the BM object to checkpartIds
- the IDs of the parts to check- Returns:
true
if computed,false
otherwise
-
isComputed
boolean isComputed(long bmObjectId, String segmentId)
Checks if the given part is computed for the given BM object.- Parameters:
bmObjectId
- the ID of the BM object to checksegmentId
- the ID of the part to check- Returns:
true
if computed,false
otherwise
-
isComputed
boolean isComputed(long bmObjectId, String partId, boolean strict)
Checks if the given part is computed for the given BM object.- 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
boolean isComputed(String... segmentIds)
Checks if the given DD segments are computed (if applicable) for all the BM objects.- Parameters:
segmentIds
- Array of the DD segment Ids to check- Returns:
true
if computed,false
otherwise
-
recomputeAll
void recomputeAll()
Forces the DD mechanism to recompute all the known parts of all the known objects.
-
removeObjectStatusListener
void removeObjectStatusListener(IDerivedDataObjectStatusListener listener)
Removes specific DD object status listener instance from the notification chain. All subscriptions of the given listener instance will be removed as a result.- Parameters:
listener
- The listener that should be removed. Cannot benull
.
-
removeStatusListener
void removeStatusListener(IDerivedDataStatusListener listener)
Removes listener that will be notified about derived data status changes.- Parameters:
listener
- the listener that should be removed.
-
unblockAsyncPipeline
void unblockAsyncPipeline(boolean forcedStop)
Force unblocking of the async. pipeline. Could stay blocked after the call of this method if async. DD computation prerequisites are not met yet.- Parameters:
forcedStop
- Unblocks the forced block in case if true. Unblocks usual lock instead.
-
updateDerviedData
boolean updateDerviedData(IDerivedDataUpdate update, long waitTimeout)
Updates derivided data using the providedIDerivedDataUpdate
update- 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
-
supplyImplicitOperationContextIfApplicable
void supplyImplicitOperationContextIfApplicable(Object computationCause, Runnable asyncEventScheduler) throws InterruptedException
Computes synchronous derived data pending for the current session (if any). The computation is synchronous.- Parameters:
computationCause
- The object bound to the computation context and used to track computations. Can benull
asyncEventScheduler
-- Throws:
InterruptedException
-
waitAllComputations
boolean waitAllComputations(long timeout) throws InterruptedException
Wait till all computations are finished or waiting time exceeds the specified value.- 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.
-
waitImportantDataComputations
boolean waitImportantDataComputations(long timeout) throws InterruptedException
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
- 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
-
waitComputation
boolean waitComputation(long timeout, boolean priority, String... scope) throws InterruptedException
Waits completion of the given scope- 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
void waitComputation(Map<Long,Collection<String>> scope) throws InterruptedException
Waits till the given scope of computations is finished.- 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
boolean waitComputation(Map<Long,Collection<String>> scope, long timeout) throws InterruptedException
Waits till the given scope of computations is finished or waiting time exceeds the specified value.- 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
boolean waitOperationComputation(Object handle, long timeout) throws InterruptedException
Waits the given operation computation- 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
boolean waitComputationExt(Map<Object,Collection<String>> scope, long timeout) throws InterruptedException
Waits till the given scope of computations is finished or waiting time exceeds the specified value.- 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.
-
startMassiveComputing
void startMassiveComputing()
Enables the massive computing mode for the DD pipeline. The mode is being desingaged after computing of all registered important tasks
-
scheduleModalOperation
Object scheduleModalOperation(Consumer<org.eclipse.core.runtime.IProgressMonitor> operation, DerivedDataSegmentBucket stage, IModalOperationController modalOperationController)
Schedules the orchestrated modal operation. SeeOperationType.MODAL
for details- 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
-
scheduleOperation
Object scheduleOperation(Consumer<org.eclipse.core.runtime.IProgressMonitor> operation, OperationType operationType, boolean important, DerivedDataSegmentBucket stage)
Schedules the orchestrated operation.- 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
-
setStageLock
StageLockRequestResult setStageLock(DerivedDataSegmentBucket stage, boolean allowDataComputing)
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.- 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
void resetStageLock(DerivedDataSegmentBucket stage)
Resets the lock being set earlier- Parameters:
stage
- The stage to re-set the bucket. May not benull
. If block isn't set - does nothing.
-
isIdle
boolean isIdle()
Checks if the computation pipeline is idle- Returns:
- True if no computations are done/possible at the moment
-
removeOperation
void removeOperation(Object handle)
Removes the previously scheduled operation. Does nothing if the operation is already removed/computed- Parameters:
handle
- The operation handle taken from theIDerivedDataManager#scheduleOperation(Consumer, OperationType, DerivedDataSegmentBucket)
call. May not be null.
-
markAsModalOperationParticipant
void markAsModalOperationParticipant()
Marks a current thread as a current modal operation participant. The mark is removed automatically on the completion of the corresponding modal operation
-
prepareForClose
void prepareForClose()
Prepares the async. computation facility for closing. Blocks all unnecessary data computations and scheduled operations and waits until all required computations are done
-
startWrappingOperationIfNesessary
void startWrappingOperationIfNesessary(Object bmOperationHandle)
Starts implicit wrapping operation for the specifiedIBmTask
in this thread in case if no operation is manually started already- Parameters:
bmOperationHandle
- The BM operation handle to wrap with the orchestrated operation. May not benull
-
completeWrappingOperationIfApplicable
void completeWrappingOperationIfApplicable(Object bmOperationHandle)
Complete implicit wrapping operation if the implicit wrapping operation were started earlier in this thread- Parameters:
bmOperationHandle
- The BM operation handle to wrap with the orchestrated operation. May not benull
-
implicitDerivedDataWait
void implicitDerivedDataWait(Object computationCause) throws InterruptedException
Waits for the derived data computation from the BM task that is wrapped by the implicit/explicit orchestrated operation- Parameters:
computationCause
- The cause of the computation. May not beNullPointerException
- Throws:
InterruptedException
-
resetActiveWrappingOperationContext
void resetActiveWrappingOperationContext(OperationContext operationContext)
Resets the active wrapping operation context associated with the current thread.- Parameters:
operationContext
- The context to reset. May not benull
-
applyForcedUpdates
void applyForcedUpdates()
Applies all forced updates provided byIDerivedDataConfigurationContributor
's
-
-