Search in sources :

Example 1 with NodeMonitor

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;
}
Also used : NodeMonitor(hudson.node_monitors.NodeMonitor)

Example 2 with NodeMonitor

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);
}
Also used : NodeMonitor(hudson.node_monitors.NodeMonitor)

Example 3 with NodeMonitor

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();
    }
}
Also used : BulkChange(hudson.BulkChange) NodeMonitor(hudson.node_monitors.NodeMonitor)

Aggregations

NodeMonitor (hudson.node_monitors.NodeMonitor)3 BulkChange (hudson.BulkChange)1