Class DtExclusiveContext

java.lang.Object
com.e1c.g5.v8.dt.internal.snapshot.DtExclusiveContext

public class DtExclusiveContext extends Object
Exclusive operation management facility for a set of DT projects.

The context contains a set of started DT projects. Each project in the set may be at one of two1 states:

  • WAITING,
  • ACQUIRED.
The following rules apply:
  • If a project is at WAITING state, an exclusive operation was enqueued for the project, but not yet started.
  • If a project is at ACQUIRED state, an exclusive operation was started for the project.
  • If a project at WAITING state is stopped, the enqueued operation for the project is cancelled and the project is removed from the context.
  • If a project at ACQUIRED state is stopped, the enqueued operation for the project is ended and the project is removed from the context.

Public methods of the class are not intended to be used concurrently.

1 States INITIAL and RELEASED are intermediate and are not observed externally.

See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    DtExclusiveContext(String operationName, IDtProjectManager dtProjectManager, IWorkspaceOrchestrator workspaceOrchestrator, IDerivedDataManagerProvider derivedDataManagerProvider)
    Constructs the DtExclusiveContext.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addProjects(Collection<org.eclipse.core.resources.IProject> projects)
    Adds projects to the exclusive context and tries to start an exclusive operation of the lowest priority for them.
    void
    Closes the context.
    Set<org.eclipse.core.resources.IProject>
    Gets projects of the context.
    boolean
    isAcquired(org.eclipse.core.resources.IProject project)
    Checks if exclusivity was acquired for the project, i.e. the respective exclusive operation was started.
    void
    release(Collection<org.eclipse.core.resources.IProject> toRelease)
    Releases the given projects, canceling respective operations.
    void
    waitAcquisition(long timeout)
    Waits until exclusivity is acquired for all projects of the context or the timeout elapsed.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • DtExclusiveContext

      public DtExclusiveContext(String operationName, IDtProjectManager dtProjectManager, IWorkspaceOrchestrator workspaceOrchestrator, IDerivedDataManagerProvider derivedDataManagerProvider)
      Constructs the DtExclusiveContext.
      Parameters:
      operationName - the name for exclusive operations, cannot be null
      dtProjectManager - the DT project manager, cannot be null
      workspaceOrchestrator - the workspace orchestrator, cannot be null
  • Method Details

    • addProjects

      public void addProjects(Collection<org.eclipse.core.resources.IProject> projects)
      Adds projects to the exclusive context and tries to start an exclusive operation of the lowest priority for them.
      Parameters:
      projects - the projects to add, cannot be null, cannot contain null values, may be empty
      Throws:
      IllegalArgumentException - if the context already contains a project
    • isAcquired

      public boolean isAcquired(org.eclipse.core.resources.IProject project)
      Checks if exclusivity was acquired for the project, i.e. the respective exclusive operation was started.
      Parameters:
      project - the project, cannot be null
      Returns:
      true if exclusivity was acquired for the project
    • waitAcquisition

      public void waitAcquisition(long timeout) throws InterruptedException
      Waits until exclusivity is acquired for all projects of the context or the timeout elapsed.
      Parameters:
      timeout - the timeout in milliseconds, must be positive
      Throws:
      InterruptedException - if the calling thread was interrupted
    • release

      public void release(Collection<org.eclipse.core.resources.IProject> toRelease)
      Releases the given projects, canceling respective operations.
      Parameters:
      toRelease - the projects to release, cannot be null, cannot contain null values, may be empty
    • close

      public void close()
      Closes the context. Releases all projects, canceling the operations.
    • getProjects

      public Set<org.eclipse.core.resources.IProject> getProjects()
      Gets projects of the context.
      Returns:
      the set of projects, which were added to the context and not released