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 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

      void confirm(String segmentId, Object objectId)
      Confirms processing of the specified context collection.
      Parameters:
      segmentId - The segment id, cannot be null
      objectId - The object id, cannot be null
    • 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

      List<String> 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

      Set<String> getReadySegments()
      Gets ready (computed) DD segments.
    • getRemainingUnitsOfWork

      int getRemainingUnitsOfWork(String segmentId)
      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

      String getSegmentName(String segmentId)
      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

      int getTotalUnitsOfWork(String segmentId)
      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

      void increasePriority(String segmentId, long bmObjectId)
      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

      void increasePriority(Map<Object,Collection<String>> scope)
      Increases the priority of computation for the given scope
      Parameters:
      scope - Identifiers of objects mapped to corresponding segments
    • increasePriority

      void increasePriority(Collection<String> segments)
      Increase priority of all segments being supplied as a scope
      Parameters:
      The - collection of priority segements. Cannot be null
    • inSync

      boolean inSync()
      Checks if the pipeline performs processing of DerivedDataSegmentBucket.SYNC stage
      Returns:
      True if the pipeline performs DD task dispatching during the resource sycnhronization at the moment
    • isLongRunningSegment

      boolean isLongRunningSegment(String segmentId)
      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

      boolean isSegmentComputed(String segmentId)
      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

      void remove(Object objectId)
      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

      String renderStatusText(String segmentId)
      Renders status text for the given segment.
      Parameters:
      segmentId - The identifier of the DD segment.
      Returns:
      The human-readable DD segment status.
    • schedule

      void schedule(Collection<IObjectDerivedDataContext> updatedContexts, Object modalOperationContext)
      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

      void unlock(String segmentId, Object objectId)
      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

      void start(BiConsumer<String,Object> unlockNotifier)
      Starts a pipeline with additional callbacks required by the computation process
      Parameters:
      unlockNotifier - unlock(String, Object) call notifier. May not be null
    • 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

      StageLockRequestResult setStageLock(DerivedDataSegmentBucket stage, boolean allowDataComputing)
      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 be null
      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

      void resetStageLock(DerivedDataSegmentBucket stage)
      Resets the stage lock, if any
      Parameters:
      stage - The stage of the async pipeline to reset the lock. May not be null
    • removeOperation

      void removeOperation(Object handle)
      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 be null
    • hasOperation

      boolean hasOperation(Object handle)
      Checks if the pipeline has a scheduled operation
      Parameters:
      handle - the operation handle. May not be null
      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

      void registerActiveOperation(OperationContext context)
      Registers the active operation context for the current thread
      Parameters:
      context - The operation context to register. May not be null
    • completeAutoWrappingOperationIfApplicable

      OperationContext completeAutoWrappingOperationIfApplicable(Object bmOperationHandle)
      Finishes the auto-wrapping operation if any for the given BM operation handle
      Parameters:
      bmOperationHandle - The handle of the executed BM operation. May not be null
      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

      void bindTaskToAnActiveOperationIfApplicable(Object bmOperationHandle)
      Binds the BM task to the manually created operation
      Parameters:
      bmOperationHandle - The BM task handle. May not be null
    • 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

      void setImplicitWaitingContext(List<IObjectDerivedDataContext> changedContexts)
      Sets the implicit waiting context to the current wrapping operation (if any)
      Parameters:
      changedContexts - The set of changed DD context. May not be null
    • resetActiveWrappingOperationContext

      void resetActiveWrappingOperationContext(OperationContext operationContext)
      Resets the binding of an operation to the current thread
      Parameters:
      operationContext - The operation context to reset the binding for. May not be null
    • 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

      void deactivateContexts(String segmentId)
      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 be null