mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-22 06:02:11 +02:00
The fix for the managed build info loadding synchronization issue. The java synchronized mechanism is used now instead of eclipse rules.
This commit is contained in:
parent
e0dddf16f8
commit
fa48007406
4 changed files with 23 additions and 33 deletions
|
@ -2181,22 +2181,10 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
|
||||||
* @param resource
|
* @param resource
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private static ManagedBuildInfo findBuildInfoSynchronized(IProject project/*, boolean create*/) {
|
synchronized private static ManagedBuildInfo findBuildInfoSynchronized(IProject project/*, boolean create*/) {
|
||||||
ManagedBuildInfo buildInfo = null;
|
ManagedBuildInfo buildInfo = null;
|
||||||
final ISchedulingRule rule = project;
|
|
||||||
IJobManager jobManager = Platform.getJobManager();
|
|
||||||
|
|
||||||
// Check if there is any build info associated with this project for this session
|
// Check if there is any build info associated with this project for this session
|
||||||
try{
|
|
||||||
try {
|
|
||||||
jobManager.beginRule(rule, null);
|
|
||||||
} catch (IllegalArgumentException e) {
|
|
||||||
// An IllegalArgumentException means that this thread job currently has a scheduling
|
|
||||||
// rule active, and it doesn't match the rule that we are requesting.
|
|
||||||
// So, we ignore the exception and assume the outer scheduling rule
|
|
||||||
// is protecting us from concurrent access
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
buildInfo = (ManagedBuildInfo)project.getSessionProperty(buildInfoProperty);
|
buildInfo = (ManagedBuildInfo)project.getSessionProperty(buildInfoProperty);
|
||||||
// Make sure that if a project has build info, that the info is not corrupted
|
// Make sure that if a project has build info, that the info is not corrupted
|
||||||
|
@ -2242,10 +2230,6 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
finally{
|
|
||||||
jobManager.endRule(rule);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (buildInfo != null && !buildInfo.isContainerInited()) {
|
if (buildInfo != null && !buildInfo.isContainerInited()) {
|
||||||
// NOTE: If this is called inside the above rule, then an IllegalArgumentException can
|
// NOTE: If this is called inside the above rule, then an IllegalArgumentException can
|
||||||
|
|
|
@ -756,9 +756,11 @@ class UpdateManagedProject12 {
|
||||||
} finally {
|
} finally {
|
||||||
// If the tree is locked spawn a job to this.
|
// If the tree is locked spawn a job to this.
|
||||||
IWorkspace workspace = project.getWorkspace();
|
IWorkspace workspace = project.getWorkspace();
|
||||||
boolean treeLock = workspace.isTreeLocked();
|
// boolean treeLock = workspace.isTreeLocked();
|
||||||
ISchedulingRule rule = workspace.getRuleFactory().createRule(project);
|
ISchedulingRule rule = workspace.getRuleFactory().createRule(project);
|
||||||
if (treeLock) {
|
//since the java synchronized mechanism is now used for the build info loadding,
|
||||||
|
//initiate the job in all cases
|
||||||
|
// if (treeLock) {
|
||||||
WorkspaceJob job = new WorkspaceJob(ConverterMessages.getResourceString("UpdateManagedProject.notice")) { //$NON-NLS-1$
|
WorkspaceJob job = new WorkspaceJob(ConverterMessages.getResourceString("UpdateManagedProject.notice")) { //$NON-NLS-1$
|
||||||
public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
|
public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
|
||||||
ManagedBuildManager.saveBuildInfo(project, false);
|
ManagedBuildManager.saveBuildInfo(project, false);
|
||||||
|
@ -767,9 +769,9 @@ class UpdateManagedProject12 {
|
||||||
};
|
};
|
||||||
job.setRule(rule);
|
job.setRule(rule);
|
||||||
job.schedule();
|
job.schedule();
|
||||||
} else {
|
// } else {
|
||||||
ManagedBuildManager.saveBuildInfo(project, false);
|
// ManagedBuildManager.saveBuildInfo(project, false);
|
||||||
}
|
// }
|
||||||
monitor.done();
|
monitor.done();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -107,9 +107,11 @@ class UpdateManagedProject20 {
|
||||||
} finally {
|
} finally {
|
||||||
// If the tree is locked spawn a job to this.
|
// If the tree is locked spawn a job to this.
|
||||||
IWorkspace workspace = project.getWorkspace();
|
IWorkspace workspace = project.getWorkspace();
|
||||||
boolean treeLock = workspace.isTreeLocked();
|
// boolean treeLock = workspace.isTreeLocked();
|
||||||
ISchedulingRule rule = workspace.getRuleFactory().createRule(project);
|
ISchedulingRule rule = workspace.getRuleFactory().createRule(project);
|
||||||
if (treeLock) {
|
// if (treeLock) {
|
||||||
|
//since the java synchronized mechanism is now used for the build info loadding,
|
||||||
|
//initiate the job in all cases
|
||||||
WorkspaceJob job = new WorkspaceJob(ConverterMessages.getResourceString("UpdateManagedProject.notice")) { //$NON-NLS-1$
|
WorkspaceJob job = new WorkspaceJob(ConverterMessages.getResourceString("UpdateManagedProject.notice")) { //$NON-NLS-1$
|
||||||
public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
|
public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
|
||||||
ManagedBuildManager.saveBuildInfo(project, false);
|
ManagedBuildManager.saveBuildInfo(project, false);
|
||||||
|
@ -118,9 +120,9 @@ class UpdateManagedProject20 {
|
||||||
};
|
};
|
||||||
job.setRule(rule);
|
job.setRule(rule);
|
||||||
job.schedule();
|
job.schedule();
|
||||||
} else {
|
// } else {
|
||||||
ManagedBuildManager.saveBuildInfo(project, false);
|
// ManagedBuildManager.saveBuildInfo(project, false);
|
||||||
}
|
// }
|
||||||
monitor.done();
|
monitor.done();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -78,11 +78,13 @@ class UpdateManagedProject21 {
|
||||||
// Eclipse content types.
|
// Eclipse content types.
|
||||||
// If the tree is locked spawn a job to this.
|
// If the tree is locked spawn a job to this.
|
||||||
IWorkspace workspace = project.getWorkspace();
|
IWorkspace workspace = project.getWorkspace();
|
||||||
boolean treeLock = workspace.isTreeLocked();
|
// boolean treeLock = workspace.isTreeLocked();
|
||||||
ISchedulingRule rule1 = workspace.getRuleFactory().createRule(project);
|
ISchedulingRule rule1 = workspace.getRuleFactory().createRule(project);
|
||||||
ISchedulingRule rule2 = workspace.getRuleFactory().refreshRule(project);
|
ISchedulingRule rule2 = workspace.getRuleFactory().refreshRule(project);
|
||||||
ISchedulingRule rule = MultiRule.combine(rule1, rule2);
|
ISchedulingRule rule = MultiRule.combine(rule1, rule2);
|
||||||
if (treeLock) {
|
//since the java synchronized mechanism is now used for the build info loadding,
|
||||||
|
//initiate the job in all cases
|
||||||
|
// if (treeLock) {
|
||||||
WorkspaceJob job = new WorkspaceJob(ConverterMessages.getResourceString("UpdateManagedProject.notice")) { //$NON-NLS-1$
|
WorkspaceJob job = new WorkspaceJob(ConverterMessages.getResourceString("UpdateManagedProject.notice")) { //$NON-NLS-1$
|
||||||
public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
|
public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
|
||||||
checkForCPPWithC(monitor, project);
|
checkForCPPWithC(monitor, project);
|
||||||
|
@ -92,10 +94,10 @@ class UpdateManagedProject21 {
|
||||||
};
|
};
|
||||||
job.setRule(rule);
|
job.setRule(rule);
|
||||||
job.schedule();
|
job.schedule();
|
||||||
} else {
|
// } else {
|
||||||
checkForCPPWithC(monitor, project);
|
// checkForCPPWithC(monitor, project);
|
||||||
ManagedBuildManager.saveBuildInfo(project, true);
|
// ManagedBuildManager.saveBuildInfo(project, true);
|
||||||
}
|
// }
|
||||||
monitor.done();
|
monitor.done();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue