mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-18 06:22:29 +00:00
modified to start monitoring slaves before anyone request the data,
so that the data is ready by the time someone shows up git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@7919 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
1 parent
da66d9e5ab
commit
0af3ec2f06
2 files changed
+30
-20
No files matched your search
@@ -21,21 +21,7 @@ import org.kohsuke.stapler.export.Exported;
|
||||
*/
|
||||
@ExportedBean
|
||||
public final class ComputerSet implements ModelObject {
|
||||
private static volatile List<NodeMonitor> monitors = Collections.emptyList();
|
||||
|
||||
public ComputerSet() {
|
||||
if(monitors.isEmpty()) {
|
||||
// create all instances when requested for the first time.
|
||||
ArrayList<NodeMonitor> r = new ArrayList<NodeMonitor>();
|
||||
for (Descriptor<NodeMonitor> d : NodeMonitor.LIST)
|
||||
try {
|
||||
r.add(d.newInstance(null,null));
|
||||
} catch (FormException e) {
|
||||
// so far impossible. TODO: report
|
||||
}
|
||||
monitors = r;
|
||||
}
|
||||
}
|
||||
private static final List<NodeMonitor> monitors;
|
||||
|
||||
@Exported
|
||||
public String getDisplayName() {
|
||||
@@ -67,4 +53,21 @@ public final class ComputerSet implements ModelObject {
|
||||
public Api getApi() {
|
||||
return new Api(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Just to force the execution of the static initializer.
|
||||
*/
|
||||
public static void initialize() {}
|
||||
|
||||
static {
|
||||
// create all instances
|
||||
ArrayList<NodeMonitor> r = new ArrayList<NodeMonitor>();
|
||||
for (Descriptor<NodeMonitor> d : NodeMonitor.LIST)
|
||||
try {
|
||||
r.add(d.newInstance(null,null));
|
||||
} catch (FormException e) {
|
||||
// so far impossible. TODO: report
|
||||
}
|
||||
monitors = r;
|
||||
}
|
||||
}
|
||||
@@ -1,21 +1,23 @@
|
||||
package hudson.triggers;
|
||||
|
||||
import antlr.ANTLRException;
|
||||
import hudson.DependencyRunner;
|
||||
import hudson.ExtensionPoint;
|
||||
import hudson.util.DoubleLaunchChecker;
|
||||
import hudson.DependencyRunner.ProjectRunnable;
|
||||
import hudson.ExtensionPoint;
|
||||
import hudson.model.AbstractProject;
|
||||
import hudson.model.Action;
|
||||
import hudson.model.Build;
|
||||
import hudson.model.ComputerSet;
|
||||
import hudson.model.Describable;
|
||||
import hudson.model.FingerprintCleanupThread;
|
||||
import hudson.model.Hudson;
|
||||
import hudson.model.Item;
|
||||
import hudson.model.Project;
|
||||
import hudson.model.WorkspaceCleanupThread;
|
||||
import hudson.model.SlaveReconnectionWork;
|
||||
import hudson.model.WorkspaceCleanupThread;
|
||||
import hudson.scheduler.CronTab;
|
||||
import hudson.scheduler.CronTabList;
|
||||
import hudson.util.DoubleLaunchChecker;
|
||||
|
||||
import java.io.InvalidObjectException;
|
||||
import java.io.ObjectStreamException;
|
||||
@@ -28,8 +30,6 @@ import java.util.concurrent.Future;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import antlr.ANTLRException;
|
||||
|
||||
/**
|
||||
* Triggers a {@link Build}.
|
||||
*
|
||||
@@ -214,5 +214,12 @@ public abstract class Trigger<J extends Item> implements Describable<Trigger<?>>
|
||||
timer.scheduleAtFixedRate(new FingerprintCleanupThread(),DAY,DAY);
|
||||
timer.scheduleAtFixedRate(new WorkspaceCleanupThread(),DAY+4*HOUR,DAY);
|
||||
timer.scheduleAtFixedRate(new SlaveReconnectionWork(),15*MIN,5*MIN);
|
||||
|
||||
// start monitoring nodes, although there's no hurry.
|
||||
timer.schedule(new SafeTimerTask() {
|
||||
public void doRun() {
|
||||
ComputerSet.initialize();
|
||||
}
|
||||
}, 1000*10);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user