提交 f014d7ac 编写于 作者: K Kohsuke Kawaguchi

Pushing the dependency computation down to another thread.

上级 5a547c91
......@@ -513,7 +513,7 @@ public abstract class AbstractItem extends Actionable implements Item, HttpDelet
// ignore
}
Jenkins.getInstance().rebuildDependencyGraph();
Jenkins.getInstance().rebuildDependencyGraphAsync();
}
/**
......@@ -592,7 +592,7 @@ public abstract class AbstractItem extends Actionable implements Item, HttpDelet
} finally {
Items.updatingByXml.set(false);
}
Jenkins.getInstance().rebuildDependencyGraph();
Jenkins.getInstance().rebuildDependencyGraphAsync();
// if everything went well, commit this new version
out.commit();
......
......@@ -772,7 +772,7 @@ public abstract class AbstractProject<P extends AbstractProject<P,R>,R extends A
Jenkins.getInstance().getQueue().scheduleMaintenance();
// this is to reflect the upstream build adjustments done above
Jenkins.getInstance().rebuildDependencyGraph();
Jenkins.getInstance().rebuildDependencyGraphAsync();
}
/**
......
......@@ -213,7 +213,7 @@ public abstract class ItemGroupMixIn {
add(result);
ItemListener.fireOnCopied(src,result);
Hudson.getInstance().rebuildDependencyGraph();
Jenkins.getInstance().rebuildDependencyGraphAsync();
return result;
}
......@@ -239,7 +239,7 @@ public abstract class ItemGroupMixIn {
add(result);
ItemListener.fireOnCreated(result);
Jenkins.getInstance().rebuildDependencyGraph();
Jenkins.getInstance().rebuildDependencyGraphAsync();
return result;
} catch (IOException e) {
......@@ -270,7 +270,7 @@ public abstract class ItemGroupMixIn {
}
item.save();
add(item);
Jenkins.getInstance().rebuildDependencyGraph();
Jenkins.getInstance().rebuildDependencyGraphAsync();
if (notify)
ItemListener.fireOnCreated(item);
......
......@@ -136,7 +136,7 @@ public class Fingerprinter extends Recorder implements Serializable, DependencyD
build.getActions().add(new FingerprintAction(build,record));
if (enableFingerprintsInDependencyGraph) {
Jenkins.getInstance().rebuildDependencyGraph();
Jenkins.getInstance().rebuildDependencyGraphAsync();
}
} catch (IOException e) {
e.printStackTrace(listener.error(Messages.Fingerprinter_Failed()));
......
......@@ -3601,6 +3601,25 @@ public class Jenkins extends AbstractCIBase implements ModifiableTopLevelItemGro
dependencyGraph = graph;
}
/**
* Rebuilds the dependency map asynchronously.
*
* <p>
* This would keep the UI thread more responsive and helps avoid the deadlocks,
* as dependency graph recomputation tends to touch a lot of other things.
*
* @since 1.522
*/
public Future<DependencyGraph> rebuildDependencyGraphAsync() {
return MasterComputer.threadPoolForRemoting.submit(new java.util.concurrent.Callable<DependencyGraph>() {
@Override
public DependencyGraph call() throws Exception {
rebuildDependencyGraph();
return dependencyGraph;
}
});
}
public DependencyGraph getDependencyGraph() {
return dependencyGraph;
}
......
......@@ -649,7 +649,7 @@ public class MavenModule extends AbstractMavenProject<MavenModule,MavenBuild> im
goals = Util.fixEmpty(req.getParameter("goals").trim());
// dependency setting might have been changed by the user, so rebuild.
Jenkins.getInstance().rebuildDependencyGraph();
Jenkins.getInstance().rebuildDependencyGraphAsync();
}
@Override
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册