use of hudson.node_monitors.NodeMonitor in project hudson-2.x by hudson.
the class ComputerSet method createDefaultInstance.
private static NodeMonitor createDefaultInstance(Descriptor<NodeMonitor> d, boolean ignored) {
try {
NodeMonitor nm = d.clazz.newInstance();
nm.setIgnored(ignored);
return nm;
} catch (InstantiationException e) {
LOGGER.log(Level.SEVERE, "Failed to instanciate " + d.clazz, e);
} catch (IllegalAccessException e) {
LOGGER.log(Level.SEVERE, "Failed to instanciate " + d.clazz, e);
}
return null;
}
use of hudson.node_monitors.NodeMonitor in project hudson-2.x by hudson.
the class ComputerSet method doUpdateNow.
/**
* Triggers the schedule update now.
*
* TODO: ajax on the client side to wait until the update completion might be nice.
*/
public void doUpdateNow(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException {
Hudson.getInstance().checkPermission(Hudson.ADMINISTER);
for (NodeMonitor nodeMonitor : NodeMonitor.getAll()) {
Thread t = nodeMonitor.triggerUpdate();
t.setName(nodeMonitor.getColumnCaption());
}
rsp.forwardToPreviousPage(req);
}
use of hudson.node_monitors.NodeMonitor in project hudson-2.x by hudson.
the class ComputerSet method doConfigSubmit.
/**
* Accepts submission from the configuration page.
*/
public synchronized void doConfigSubmit(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException, FormException {
BulkChange bc = new BulkChange(MONITORS_OWNER);
try {
Hudson.getInstance().checkPermission(Hudson.ADMINISTER);
monitors.rebuild(req, req.getSubmittedForm(), getNodeMonitorDescriptors());
// add in the rest of instances are ignored instances
for (Descriptor<NodeMonitor> d : NodeMonitor.all()) if (monitors.get(d) == null) {
NodeMonitor i = createDefaultInstance(d, true);
if (i != null)
monitors.add(i);
}
rsp.sendRedirect2(".");
} finally {
bc.commit();
}
}
Aggregations