Class DtExclusiveContext
java.lang.Object
com.e1c.g5.v8.dt.internal.snapshot.DtExclusiveContext
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.
- 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.
-
Constructor Summary
ConstructorsConstructorDescriptionDtExclusiveContext
(String operationName, IDtProjectManager dtProjectManager, IWorkspaceOrchestrator workspaceOrchestrator, IDerivedDataManagerProvider derivedDataManagerProvider) Constructs theDtExclusiveContext
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
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
close()
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.
-
Constructor Details
-
DtExclusiveContext
public DtExclusiveContext(String operationName, IDtProjectManager dtProjectManager, IWorkspaceOrchestrator workspaceOrchestrator, IDerivedDataManagerProvider derivedDataManagerProvider) Constructs theDtExclusiveContext
.- Parameters:
operationName
- the name for exclusive operations, cannot benull
dtProjectManager
- the DT project manager, cannot benull
workspaceOrchestrator
- the workspace orchestrator, cannot benull
-
-
Method Details
-
addProjects
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 benull
, cannot containnull
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 benull
- Returns:
- true if exclusivity was acquired for the project
-
waitAcquisition
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
Releases the given projects, canceling respective operations.- Parameters:
toRelease
- the projects to release, cannot benull
, cannot containnull
values, may be empty
-
close
public void close()Closes the context. Releases all projects, canceling the operations. -
getProjects
Gets projects of the context.- Returns:
- the set of projects, which were added to the context and not released
-