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
|
||||
* @return
|
||||
*/
|
||||
private static ManagedBuildInfo findBuildInfoSynchronized(IProject project/*, boolean create*/) {
|
||||
synchronized private static ManagedBuildInfo findBuildInfoSynchronized(IProject project/*, boolean create*/) {
|
||||
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
|
||||
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 {
|
||||
buildInfo = (ManagedBuildInfo)project.getSessionProperty(buildInfoProperty);
|
||||
// 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()) {
|
||||
// NOTE: If this is called inside the above rule, then an IllegalArgumentException can
|
||||
|
|
|
@ -756,9 +756,11 @@ class UpdateManagedProject12 {
|
|||
} finally {
|
||||
// If the tree is locked spawn a job to this.
|
||||
IWorkspace workspace = project.getWorkspace();
|
||||
boolean treeLock = workspace.isTreeLocked();
|
||||
// boolean treeLock = workspace.isTreeLocked();
|
||||
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$
|
||||
public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
|
||||
ManagedBuildManager.saveBuildInfo(project, false);
|
||||
|
@ -767,9 +769,9 @@ class UpdateManagedProject12 {
|
|||
};
|
||||
job.setRule(rule);
|
||||
job.schedule();
|
||||
} else {
|
||||
ManagedBuildManager.saveBuildInfo(project, false);
|
||||
}
|
||||
// } else {
|
||||
// ManagedBuildManager.saveBuildInfo(project, false);
|
||||
// }
|
||||
monitor.done();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -107,9 +107,11 @@ class UpdateManagedProject20 {
|
|||
} finally {
|
||||
// If the tree is locked spawn a job to this.
|
||||
IWorkspace workspace = project.getWorkspace();
|
||||
boolean treeLock = workspace.isTreeLocked();
|
||||
// boolean treeLock = workspace.isTreeLocked();
|
||||
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$
|
||||
public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
|
||||
ManagedBuildManager.saveBuildInfo(project, false);
|
||||
|
@ -118,9 +120,9 @@ class UpdateManagedProject20 {
|
|||
};
|
||||
job.setRule(rule);
|
||||
job.schedule();
|
||||
} else {
|
||||
ManagedBuildManager.saveBuildInfo(project, false);
|
||||
}
|
||||
// } else {
|
||||
// ManagedBuildManager.saveBuildInfo(project, false);
|
||||
// }
|
||||
monitor.done();
|
||||
}
|
||||
|
||||
|
|
|
@ -78,11 +78,13 @@ class UpdateManagedProject21 {
|
|||
// Eclipse content types.
|
||||
// If the tree is locked spawn a job to this.
|
||||
IWorkspace workspace = project.getWorkspace();
|
||||
boolean treeLock = workspace.isTreeLocked();
|
||||
// boolean treeLock = workspace.isTreeLocked();
|
||||
ISchedulingRule rule1 = workspace.getRuleFactory().createRule(project);
|
||||
ISchedulingRule rule2 = workspace.getRuleFactory().refreshRule(project);
|
||||
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$
|
||||
public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
|
||||
checkForCPPWithC(monitor, project);
|
||||
|
@ -92,10 +94,10 @@ class UpdateManagedProject21 {
|
|||
};
|
||||
job.setRule(rule);
|
||||
job.schedule();
|
||||
} else {
|
||||
checkForCPPWithC(monitor, project);
|
||||
ManagedBuildManager.saveBuildInfo(project, true);
|
||||
}
|
||||
// } else {
|
||||
// checkForCPPWithC(monitor, project);
|
||||
// ManagedBuildManager.saveBuildInfo(project, true);
|
||||
// }
|
||||
monitor.done();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue