Serialize LoadTargetDefinitionJob per target handle#2338
Draft
vogella wants to merge 1 commit into
Draft
Conversation
Clicking "Reload Target Platform" on the editor toolbar calls LoadTargetDefinitionJob.load(target), which cancels any prior load via Job.getJobManager().cancel(JOB_FAMILY_ID) and immediately schedules a new one. Job.cancel only sets a flag, so the in-flight load keeps running until its next monitor check. Repeat clicks therefore pile up "Load Target Platform (Cancel Requested)" entries plus their submonitor "Loading target platform information: Reading plug-ins" lines in the Progress view, and two loads of the same target can race on the p2 profile lock/unlock pair inside P2TargetUtils.deleteProfile. Commit 37f88d7 fixed the same pattern for the editor's resolve job but did not cover the explicit Reload action, which also calls target.resolve() internally. Promote the per-target-handle ISchedulingRule from TargetEditor into a shared TargetResolveSchedulingRule under org.eclipse.pde.internal.core.target, and apply it to both LoadTargetDefinitionJob and the editor's resolve job. Because both jobs now share the same rule keyed by the handle memento, a Reload also serializes against an in-flight editor resolve for the same target. Operations on different targets remain independent.
4af23b0 to
e7236a6
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Clicking "Reload Target Platform" on the editor toolbar cancels the in-flight load and immediately schedules a new one, but
Job.cancelonly flips a flag, so the cancelled job keeps running until its next monitor check. Repeated clicks therefore pile up "Load Target Platform (Cancel Requested)" entries in the Progress view, and two loads of the same target can race on the p2 profile lock/unlock pair insideP2TargetUtils.deleteProfile.Commit 37f88d7 addressed the same pattern for the editor's resolve job but did not cover the explicit Reload action, which also calls
target.resolve()internally. This change promotes the per-target-handle scheduling rule fromTargetEditorinto a sharedTargetResolveSchedulingRuleand applies it to bothLoadTargetDefinitionJoband the editor's resolve job, so loads and resolves of the same target serialize while operations on different targets remain independent.Planned for 4.41.