added a method to connect to all offline slaves.

git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@3937 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
kohsuke committed 2007-07-30 01:01:14 +00:00
1 parent dd586b6dab
commit c459f724d4
4 files changed
+28 -1

No files matched your search

@@ -85,6 +85,14 @@ public abstract class Computer implements ModelObject {
*/
public abstract void doLaunchSlaveAgent( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException;
/**
* Do the same as {@link #doLaunchSlaveAgent(StaplerRequest, StaplerResponse)}
* but outside the context of serving a request.
*
* If already connected, no-op.
*/
public abstract void launch();
/**
* Number of {@link Executor}s that are configured for this computer.
*
@@ -8,6 +8,7 @@ import org.kohsuke.stapler.StaplerResponse;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.io.IOException;
/**
* Serves as the top of {@link Computer}s in the URL hierarchy.
@@ -48,4 +49,13 @@ public final class ComputerSet implements ModelObject {
public Computer getDynamic(String token, StaplerRequest req, StaplerResponse rsp) {
return Hudson.getInstance().getComputer(token);
}
public void do_launchAll(StaplerRequest req, StaplerResponse rsp) throws IOException {
for(Computer c : get_all()) {
if(c.isJnlpAgent())
continue;
c.launch();
}
rsp.sendRedirect(".");
}
}
@@ -1719,6 +1719,10 @@ public final class Hudson extends View implements ItemGroup<TopLevelItem>, Node
rsp.sendError(HttpServletResponse.SC_NOT_FOUND);
}
public void launch() {
// noop
}
/**
* {@link LocalChannel} instance that can be used to execute programs locally.
*/
+6 -1
View File
@@ -406,13 +406,18 @@ public final class Slave implements Node, Serializable {
return;
}
launch(getNode());
launch();
// TODO: would be nice to redirect the user to "launching..." wait page,
// then spend a few seconds there and poll for the completion periodically.
rsp.sendRedirect("log");
}
public void launch() {
if(channel==null)
launch(getNode());
}
/**
* Gets the string representation of the slave log.
*/