Class DerivedDataContextManager

java.lang.Object
com._1c.g5.v8.internal.derived.context.DerivedDataContextManager
All Implemented Interfaces:
IContextTransactionManager, IDerivedDataContextManager

public class DerivedDataContextManager extends Object implements IDerivedDataContextManager, IContextTransactionManager
Implementation of the IDerivedDataContextManager.
  • Constructor Details

  • Method Details

    • clearOnEmptyPipeline

      public void clearOnEmptyPipeline()
      Description copied from interface: IDerivedDataContextManager
      Clears all global contexts in case if no unfinished DD computations/tasks are available. Removes accumulation global contexts, etc.
      Specified by:
      clearOnEmptyPipeline in interface IDerivedDataContextManager
    • closeSession

      public void closeSession(IContextCollectingSession session)
      Description copied from interface: IDerivedDataContextManager
      Finishes processing of the session, removing all effective context locks.
      Specified by:
      closeSession in interface IDerivedDataContextManager
    • commit

      public void commit(Object transactionHandle)
      Description copied from interface: IContextTransactionManager
      Commits the transaction.
      Specified by:
      commit in interface IContextTransactionManager
      Parameters:
      transactionHandle - The handle of the context manipulaton transaction. Cannot be null.
    • confirmOperationComputation

      public void confirmOperationComputation(OperationContext operationContext, Object transactionHandle)
      Description copied from interface: IContextTransactionManager
      Confirms the computation of the given operation
      Specified by:
      confirmOperationComputation in interface IContextTransactionManager
      Parameters:
      operationContext - The context of the operation. May not be null
      transactionHandle - The handle of the context manipulaton transaction. Cannot be null.
    • deactivateContexts

      public void deactivateContexts(String segmentId)
      Description copied from interface: IDerivedDataContextManager
      Perform mass deactivation of contexts
      Specified by:
      deactivateContexts in interface IDerivedDataContextManager
      Parameters:
      segmentId - Target segment of async. processing pipeline for the deactivation
    • createContextCollectingSession

      public IContextCollectingSession createContextCollectingSession(Object computationCause)
      Description copied from interface: IDerivedDataContextManager
      Create synchronous DD context collecting session.
      Specified by:
      createContextCollectingSession in interface IDerivedDataContextManager
      Parameters:
      computationCause - The cause of the computation (the context, usually a task, which requires sync. DD computation as a part of performed changes).
      Returns:
      The corresponding DD context collecting session.
    • createContextLoadingSession

      public IContextCollectingSession createContextLoadingSession()
      Description copied from interface: IDerivedDataContextManager
      Creates a special context loading session that is used to process unfinished contexts during the start of EDT and schedule them to the DD pipeline
      Specified by:
      createContextLoadingSession in interface IDerivedDataContextManager
      Returns:
      The loading session. Cannot be null
    • createContextCollectingSession

      public IContextCollectingSession createContextCollectingSession(Object computationCause, boolean trackWaitingScope)
      Description copied from interface: IDerivedDataContextManager
      Create synchronous DD context collecting session.
      Specified by:
      createContextCollectingSession in interface IDerivedDataContextManager
      Parameters:
      computationCause - The cause of the computation (the context, usually a task, which requires sync. DD computation as a part of performed changes).
      trackWaitingScope - Enables tracking of implicit waiting context if true
      Returns:
      The corresponding DD context collecting session.
    • getExistingObjectContext

      public IObjectDerivedDataContext getExistingObjectContext(Object objectId, String segmentId, Object computationCause, Object transactionHandle)
      Description copied from interface: IContextTransactionManager
      Returns the existing object context.
      Specified by:
      getExistingObjectContext in interface IContextTransactionManager
      Parameters:
      objectId - Target object, cannot be null.
      segmentId - The identifier of the target DD segment, cannot be null.
      computationCause - The computation cause, cannot be null.
      transactionHandle - The handle of the context manipulaton transaction, cannot be null.
      Returns:
      The target context (if any available or possible for the object), never null.
    • getObjectContext

      public IObjectDerivedDataContext getObjectContext(IBmObject bmObject, String segmentId, Object computationCause, Object transactionHandle)
      Description copied from interface: IContextTransactionManager
      Gathers object context for the given object (if any).
      Specified by:
      getObjectContext in interface IContextTransactionManager
      Parameters:
      bmObject - Target BM object. Cannot be null.
      segmentId - The identifier of the target DD segment. Cannot be null.
      transactionHandle - The handle of the context manipulaton transaction. Cannot be null.
      Returns:
      The target context (if any available or possible for the object).
    • getObjectContext

      public IObjectDerivedDataContext getObjectContext(long bmObjectId, org.eclipse.emf.ecore.EClass eClass, String segmentId, Object object, Object transactionHandle)
      Description copied from interface: IContextTransactionManager
      Gathers object context for the given object (if any).
      Specified by:
      getObjectContext in interface IContextTransactionManager
      Parameters:
      bmObjectId - The identifier of the object to get the context for for.
      eClass - The EClass of the object to get the context for. Cannot be null
      segmentId - The identifier of the target DD segment. Cannot be null.
      object - The object, cannot be null.
      transactionHandle - The handle of the context manipulaton transaction. Cannot be null.
      Returns:
      The target context (if any available or possible for the object).
    • getObjectContext

      public IObjectDerivedDataContext getObjectContext(Object objectId, org.eclipse.emf.ecore.EClass eClass, String segmentId, Object computationCause, Object transactionHandle)
      Description copied from interface: IContextTransactionManager
      Gathers object context for the given object (if any).
      Specified by:
      getObjectContext in interface IContextTransactionManager
      Parameters:
      objectId - Target object, cannot be null.
      eClass - The EClass of the object, cannot be null.
      segmentId - The identifier of the target DD segment, cannot be null.
      transactionHandle - The handle of the context manipulaton transaction, cannot be null.
      Returns:
      The target context (if any available or possible for the object), never null.
    • isContextExists

      public boolean isContextExists(org.eclipse.emf.ecore.EClass topObjectEClass, long topObjectId, String segmentId)
      Description copied from interface: IContextTransactionManager
      Checks if the DD context exists(supported) for the given object and segment
      Specified by:
      isContextExists in interface IContextTransactionManager
      Parameters:
      topObjectEClass - Top object EClass. May not be null
      topObjectId - Top object identifier. May not be null
      segmentId - The DD segment identifier. May not be null
      Returns:
      True if the context exists/may be created
    • isContextExists

      public boolean isContextExists(IBmObject bmObject, String segmentId)
      Description copied from interface: IContextTransactionManager
      Checks if the DD context exists(supported) for the given object and segment
      Specified by:
      isContextExists in interface IContextTransactionManager
      Parameters:
      bmObject - The object to get the context for. May not be null
      segmentId - The DD segment identifier. May not be null
      Returns:
      True if the context exists/may be created
    • markAsComputed

      public void markAsComputed(IObjectDerivedDataContext context, Object transactionHandle)
      Description copied from interface: IContextTransactionManager
      Marks the context as a computed. Will be re-set on a commit.
      Specified by:
      markAsComputed in interface IContextTransactionManager
      Parameters:
      context - Transaction context. Cannot be null.
      transactionHandle - The handle of the context manipulaton transaction. Cannot be null.
    • markAsFailed

      public void markAsFailed(IObjectDerivedDataContext context, Object transactionHandle)
      Description copied from interface: IContextTransactionManager
      Marks a specified context as failed to compute.
      Specified by:
      markAsFailed in interface IContextTransactionManager
      Parameters:
      context - The context to mark as failed. Cannot be null.
      transactionHandle - The handle of the context manipulaton transaction. Cannot be null.
    • popChangedContexts

      public List<IObjectDerivedDataContext> popChangedContexts(Object computationCause)
      Gets updated contexts and removes them from the queue
      Parameters:
      computationCause - The computation cause to get updated contexts for. May not be null
      Returns:
      Changed contexts set. May not be null
    • processAccumulatedContexts

      public void processAccumulatedContexts()
      Description copied from interface: IDerivedDataContextManager
      Processes accumulated contexts (if any), sending corresponding DD context updates to the corresponding consumer (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 interface IDerivedDataContextManager
    • registerContextUpdateListener

      public void registerContextUpdateListener(IContextUpdateListener listener)
      Description copied from interface: IDerivedDataContextManager
      Registers the context update listener.
      Specified by:
      registerContextUpdateListener in interface IDerivedDataContextManager
      Parameters:
      listener - The listener to register.
    • registerTransaction

      public Object registerTransaction(boolean computation, boolean forcedUpdate, Object computationCause, boolean trackWaitingScope)
      Description copied from interface: IContextTransactionManager
      Registers a transaction in the lock manager. Throws an exception if there are too many concurrent transactions.
      Specified by:
      registerTransaction in interface IContextTransactionManager
      Parameters:
      computation - True in case if this a DD context computation transaction; false otherwise.
      forcedUpdate - Forces update of contexts, even if they aren't changed
      trackWaitingScope - Enables tracking of implicit waiting context if true
      Returns:
      the registered transaction handle, never null.
    • rollback

      public void rollback(Object transactionHandle)
      Description copied from interface: IContextTransactionManager
      Rolls the transaction back, cancelling all collected context changes.
      Specified by:
      rollback in interface IContextTransactionManager
      Parameters:
      transactionHandle - The handle of the context manipulaton transaction. Cannot be null.
    • scheduleModalOperation

      public IObjectDerivedDataContext scheduleModalOperation(Consumer<org.eclipse.core.runtime.IProgressMonitor> operation, String segmentId, IModalOperationController modalOperationController, Object transactionHandle)
      Description copied from interface: IContextTransactionManager
      Schedules a new modal operation
      Specified by:
      scheduleModalOperation in interface IContextTransactionManager
      Parameters:
      operation - The operation logic to schedule. May not be null
      modalOperationController - The modal operation controller. May not be null
      Returns:
      The operation handle for external operation referencing, may not be null
    • scheduleOperation

      public IObjectDerivedDataContext scheduleOperation(Consumer<org.eclipse.core.runtime.IProgressMonitor> operation, OperationType operationType, boolean important, String segmentId, Object transactionHandle)
      Description copied from interface: IContextTransactionManager
      Schedules an operation context. Always creates a new one as an operation is non-identifiable
      Specified by:
      scheduleOperation in interface IContextTransactionManager
      Parameters:
      operation - The operation executable. May not be null
      operationType - The operation type. May not be null
      segmentId - The target async pipeline operation segment. May not be null
      transactionHandle - The handle of the context manipulaton transaction. Cannot be null.
      Returns:
      The operation context. May not be null
    • scheduleOperationRemoval

      public void scheduleOperationRemoval(IObjectDerivedDataContext operationHandle, Object transactionHandle)
      Description copied from interface: IContextTransactionManager
      Schedules the operation removal
      Specified by:
      scheduleOperationRemoval in interface IContextTransactionManager
      Parameters:
      operationHandle - The handle of the previously scheduled operation. May not be null
      transactionHandle - The handle of the context manipulaton transaction. Cannot be null.
    • setScopeTrackerController

      public void setScopeTrackerController(IScopeTrackerController scopeTrackerController)
      Sets the external scope tracker controller
      Parameters:
      scopeTrackerController - The controller to set. May not be null
    • unregisterContextUpdateListener

      public void unregisterContextUpdateListener(IContextUpdateListener listener)
      Description copied from interface: IDerivedDataContextManager
      Removes previously registered listener.
      Specified by:
      unregisterContextUpdateListener in interface IDerivedDataContextManager
      Parameters:
      listener - The listener to remove.
    • waitAccumulatedContextProcessing

      public boolean waitAccumulatedContextProcessing(long timeout)
      Description copied from interface: IDerivedDataContextManager
      The caller of this method waits on this method until all accumulated yet not processed DD context updates are being processed. This allows to be sure that the required scope (e.g. for waiting) is already known/or cleared to the DD after this call
      Specified by:
      waitAccumulatedContextProcessing in interface IDerivedDataContextManager
      Parameters:
      timeout - Wait timeout in ms. -1 means no timeout
      Returns:
      True if waiting is successfull