Avoid update maven project from deadlocking after...
@ConfigurationProperties quickfix
This commit is contained in:
@@ -49,11 +49,14 @@ import org.apache.maven.project.MavenProject;
|
||||
import org.eclipse.core.resources.IContainer;
|
||||
import org.eclipse.core.resources.IFile;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.resources.ResourcesPlugin;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
import org.eclipse.core.runtime.Status;
|
||||
import org.eclipse.core.runtime.SubMonitor;
|
||||
import org.eclipse.core.runtime.jobs.Job;
|
||||
import org.eclipse.debug.core.DebugPlugin;
|
||||
@@ -317,11 +320,26 @@ public class MavenSpringBootProject extends SpringBootProject {
|
||||
|
||||
@Override
|
||||
public Job updateProjectConfiguration() {
|
||||
Job job = new UpdateMavenProjectJob(new IProject[] {
|
||||
getProject()
|
||||
});
|
||||
job.schedule();
|
||||
return job;
|
||||
//We wrap the UpdateMavenProjectJob in another job to avoid a race condition
|
||||
//that causes a deadlock. The race condition is avoided by have the
|
||||
//waitForWorkspaceLock wrapper which ensures that pending workspace jobs
|
||||
//are finished before triggering maven project update.
|
||||
//See: https://github.com/spring-projects/sts4/issues/780
|
||||
Job waitForWorkspaceLock = new Job("Wait for for workspace") {
|
||||
{
|
||||
setRule(ResourcesPlugin.getWorkspace().getRuleFactory().buildRule());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IStatus run(IProgressMonitor arg0) {
|
||||
Job job = new UpdateMavenProjectJob(new IProject[] {
|
||||
getProject()
|
||||
});
|
||||
job.schedule();
|
||||
return Status.OK_STATUS;
|
||||
}
|
||||
};
|
||||
return waitForWorkspaceLock;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user