A resource rule factory returns scheduling rules for API methods that modify the workspace. These rules can be used when creating jobs or other operations that perform a series of modifications on the workspace. This allows clients to implement two phase commit semantics, where all necessary rules are obtained prior to executing a long running operation.
Note that simple use of the workspace APIs does not require use of scheduling rules. All workspace API methods that modify the workspace will automatically obtain any scheduling rules needed to perform the modification. However, if you are aggregating a set of changes to the workspace using WorkspaceJob
or IWorkspaceRunnable
you can use scheduling rules to lock a portion of the workspace for the duration of the job or runnable. If you provide a non-null scheduling rule, a runtime exception will occur if you try to modify a portion of the workspace that is not covered by the rule for the runnable or job.
If more than one rule is needed, they can be aggregated using the MultiRule.combine
method. Simplifying a group of rules does not change the set of resources that are covered, but can improve job scheduling performance.
Note that null
is a valid scheduling rule (indicating that no resources need to be locked), and thus all methods in this class may return null
.
This interface is not intended to be implemented by clients.
@see WorkspaceJob
@see IWorkspace#run(IWorkspaceRunnable,ISchedulingRule,int,org.eclipse.core.runtime.IProgressMonitor)
@see org.eclipse.core.runtime.jobs.MultiRule#combine(ISchedulingRule,ISchedulingRule)
@since 3.0