diff --git a/.cvsignore b/.cvsignore index bf18d64869..acc422a34f 100644 --- a/.cvsignore +++ b/.cvsignore @@ -1,5 +1,5 @@ target .svn pom.ipr -pom.iml +pom.iml pom.iws diff --git a/core/src/main/java/hudson/Functions.java b/core/src/main/java/hudson/Functions.java index d97f64e451..034bca9a52 100644 --- a/core/src/main/java/hudson/Functions.java +++ b/core/src/main/java/hudson/Functions.java @@ -1,7 +1,21 @@ package hudson; import hudson.maven.ExecutedMojo; -import hudson.model.*; +import hudson.model.AbstractProject; +import hudson.model.Action; +import hudson.model.Descriptor; +import hudson.model.Hudson; +import hudson.model.Item; +import hudson.model.ItemGroup; +import hudson.model.Items; +import hudson.model.Job; +import hudson.model.JobPropertyDescriptor; +import hudson.model.ModelObject; +import hudson.model.Node; +import hudson.model.Project; +import hudson.model.Run; +import hudson.model.TopLevelItem; +import hudson.model.View; import hudson.search.SearchableModelObject; import hudson.tasks.BuildStep; import hudson.tasks.BuildStepDescriptor; @@ -493,14 +507,6 @@ public class Functions { return BuildStepDescriptor.filter(BuildStep.PUBLISHERS, project.getClass()); } - public static List> getSlaveStartMethodDescriptors() { - return SlaveStartMethod.LIST; - } - - public static List> getSlaveAvailabilityStrategyDescriptors() { - return SlaveAvailabilityStrategy.LIST; - } - /** * Computes the path to the icon of the given action * from the context path. diff --git a/core/src/main/java/hudson/model/Computer.java b/core/src/main/java/hudson/model/Computer.java index 3933c2e631..e2abbcd3ec 100644 --- a/core/src/main/java/hudson/model/Computer.java +++ b/core/src/main/java/hudson/model/Computer.java @@ -125,22 +125,12 @@ public abstract class Computer extends AbstractModelObject { /** * Returns true if this computer is supposed to be launched via JNLP. - * @deprecated see {@linkplain #isStartSupported()} and {@linkplain hudson.model.SlaveStartMethod} */ @Exported - @Deprecated public boolean isJnlpAgent() { return false; } - /** - * Returns true if this computer can be launched by Hudson. - */ - @Exported - public boolean isStartSupported() { - return true; - } - /** * Returns true if this node is marked temporarily offline by the user. * @@ -191,7 +181,7 @@ public abstract class Computer extends AbstractModelObject { public List getTiedJobs() { return getNode().getSelfLabel().getTiedJobs(); } - + public RunList getBuilds() { return new RunList(Hudson.getInstance().getAllItems(Job.class)).node(getNode()); } diff --git a/core/src/main/java/hudson/model/ComputerSet.java b/core/src/main/java/hudson/model/ComputerSet.java index 796f5374a8..1eeae9f5fd 100644 --- a/core/src/main/java/hudson/model/ComputerSet.java +++ b/core/src/main/java/hudson/model/ComputerSet.java @@ -16,7 +16,7 @@ import org.kohsuke.stapler.export.Exported; * Serves as the top of {@link Computer}s in the URL hierarchy. *

* Getter methods are prefixed with '_' to avoid collision with computer names. - * + * * @author Kohsuke Kawaguchi */ @ExportedBean @@ -43,13 +43,13 @@ public final class ComputerSet implements ModelObject { public void do_launchAll(StaplerRequest req, StaplerResponse rsp) throws IOException { for(Computer c : get_all()) { - if(c.isStartSupported()) + if(c.isJnlpAgent()) continue; c.launch(); } rsp.sendRedirect("."); } - + public Api getApi() { return new Api(this); } diff --git a/core/src/main/java/hudson/model/Hudson.java b/core/src/main/java/hudson/model/Hudson.java index 3dbc281bcc..d1a4154197 100644 --- a/core/src/main/java/hudson/model/Hudson.java +++ b/core/src/main/java/hudson/model/Hudson.java @@ -65,7 +65,6 @@ import hudson.util.TextFile; import hudson.util.XStream2; import hudson.widgets.Widget; import net.sf.json.JSONObject; -import net.sf.json.JSONArray; import org.acegisecurity.AccessDeniedException; import org.acegisecurity.Authentication; import org.acegisecurity.GrantedAuthority; @@ -179,7 +178,7 @@ public final class Hudson extends View implements ItemGroup, Node, *

* Intuitively, this corresponds to the user database. * - * See {@link HudsonFilter} for the concrete authentication protocol. + * See {@link HudsonFilter} for the concrete authentication protocol. * * Never null. Always use {@link #setSecurityRealm(SecurityRealm)} to * update this field. @@ -395,7 +394,7 @@ public final class Hudson extends View implements ItemGroup, Node, /** * Returns a secret key that survives across container start/stop. *

- * This value is useful for implementing some of the security features. + * This value is useful for implementing some of the security features. */ public String getSecretKey() { return secretKey; @@ -1315,7 +1314,7 @@ public final class Hudson extends View implements ItemGroup, Node, authorizationStrategy = AuthorizationStrategy.UNSECURED; setSecurityRealm(SecurityRealm.NO_AUTHENTICATION); } - + LOGGER.info(String.format("Took %s ms to load",System.currentTimeMillis()-startTime)); } @@ -1422,10 +1421,30 @@ public final class Hudson extends View implements ItemGroup, Node, } } + numExecutors = Integer.parseInt(req.getParameter("numExecutors")); quietPeriod = Integer.parseInt(req.getParameter("quiet_period")); systemMessage = Util.nullify(req.getParameter("system_message")); + {// update slave list + List newSlaves = new ArrayList(); + String[] names = req.getParameterValues("slave.name"); + if(names!=null) { + for(int i=0;i< names.length;i++) { + newSlaves.add(req.bindParameters(Slave.class,"slave.",i)); + } + } + this.slaves = newSlaves; + updateComputerList(); + + // label trim off + for (Label l : labels.values()) { + l.reset(); + if(l.getNodes().isEmpty()) + labels.remove(l); + } + } + {// update JDK installations jdks.clear(); String[] names = req.getParameterValues("jdk_name"); @@ -1468,83 +1487,6 @@ public final class Hudson extends View implements ItemGroup, Node, } } - /** - * Accepts submission from the configuration page. - */ - public synchronized void doConfigExecutorsSubmit( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException { - try { - checkPermission(ADMINISTER); - - req.setCharacterEncoding("UTF-8"); - - JSONObject json = StructuredForm.get(req); - - numExecutors = Integer.parseInt(req.getParameter("numExecutors")); - - { - // update slave list - Object src = json.get("slaves"); - ArrayList r = new ArrayList(); - if (src instanceof JSONObject) { - r.add(newSlave(req, (JSONObject) src)); - } - if (src instanceof JSONArray) { - JSONArray a = (JSONArray) src; - for (Object o : a) { - if (o instanceof JSONObject) { - r.add(newSlave(req, (JSONObject) o)); - } - } - } - this.slaves = r; - updateComputerList(); - - // label trim off - for (Label l : labels.values()) { - l.reset(); - if(l.getNodes().isEmpty()) - labels.remove(l); - } - } - - boolean result = true; - - save(); - - if(result) - rsp.sendRedirect(req.getContextPath()+'/'); // go to the top page - else - rsp.sendRedirect("configure"); // back to config - } catch (FormException e) { - sendError(e,req,rsp); - } - } - - private Slave newSlave(StaplerRequest req, JSONObject j) throws FormException { - final SlaveStartMethod startMethod = newDescribedChild(req, j, "startMethod", SlaveStartMethod.LIST); - final SlaveAvailabilityStrategy availabilityStrategy = - newDescribedChild(req, j, "availabilityStrategy", SlaveAvailabilityStrategy.LIST); - final Slave slave = req.bindJSON(Slave.class, j); - slave.setStartMethod(startMethod); - slave.setAvailabilityStrategy(availabilityStrategy); - return slave; - } - - private > T newDescribedChild(StaplerRequest req, JSONObject j, - String name, List> descriptors) - throws FormException { - final String clazz = j.get(name + "Class").toString(); - final JSONObject data = j.getJSONObject(name); - j.remove(name + "Class"); - j.remove(name); - for (Descriptor d: descriptors) { - if (d.getClass().getName().equals(clazz)) { - return d.newInstance(req, data); - } - } - return null; - } - /** * Accepts the new description. */ @@ -1982,7 +1924,7 @@ public final class Hudson extends View implements ItemGroup, Node, PrintWriter w = rsp.getWriter(); w.println("Shutting down"); w.close(); - + System.exit(0); } @@ -2446,7 +2388,7 @@ public final class Hudson extends View implements ItemGroup, Node, /** * Prefix to static resources like images and javascripts in the war file. * Either "" or strings like "/static/VERSION", which avoids Hudson to pick up - * stale cache when the user upgrades to a different version. + * stale cache when the user upgrades to a different version. */ public static String RESOURCE_PATH; diff --git a/core/src/main/java/hudson/model/Node.java b/core/src/main/java/hudson/model/Node.java index d63c54e62a..c750ae6fa4 100644 --- a/core/src/main/java/hudson/model/Node.java +++ b/core/src/main/java/hudson/model/Node.java @@ -6,10 +6,6 @@ import hudson.node_monitors.NodeMonitor; import hudson.util.EnumConverter; import hudson.util.ClockDifference; import org.kohsuke.stapler.Stapler; -import org.kohsuke.stapler.StaplerRequest; -import org.kohsuke.stapler.StaplerResponse; -import org.kohsuke.stapler.Stapler; -import org.acegisecurity.ui.AbstractProcessingFilter; import java.util.Set; import java.io.IOException; @@ -140,8 +136,7 @@ public interface Node { } static { - Stapler.CONVERT_UTILS.register(new EnumConverter(), Mode.class); + Stapler.CONVERT_UTILS.register(new EnumConverter(),Mode.class); } } - } diff --git a/core/src/main/java/hudson/model/Slave.java b/core/src/main/java/hudson/model/Slave.java index b2c04555d5..28382f0919 100644 --- a/core/src/main/java/hudson/model/Slave.java +++ b/core/src/main/java/hudson/model/Slave.java @@ -23,7 +23,6 @@ import hudson.util.StreamCopyThread; import hudson.util.StreamTaskListener; import org.kohsuke.stapler.StaplerRequest; import org.kohsuke.stapler.StaplerResponse; -import org.kohsuke.stapler.DataBoundConstructor; import javax.servlet.ServletException; import javax.servlet.http.HttpServletResponse; @@ -37,13 +36,16 @@ import java.io.PrintWriter; import java.io.Serializable; import java.net.URL; import java.net.URLConnection; -import java.util.*; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Date; +import java.util.HashSet; +import java.util.List; +import java.util.Set; import java.util.logging.Level; import java.util.logging.LogRecord; import java.util.logging.Logger; -import net.sf.json.JSONObject; - /** * Information about a Hudson slave node. * @@ -77,14 +79,10 @@ public final class Slave implements Node, Serializable { private Mode mode; /** - * Slave availablility strategy. + * Command line to launch the agent, like + * "ssh myslave java -jar /path/to/hudson-remoting.jar" */ - private SlaveAvailabilityStrategy availabilityStrategy; - - /** - * The starter that will startup this slave. - */ - private SlaveStartMethod startMethod; + private String agentCommand; /** * Whitespace-separated labels. @@ -102,12 +100,13 @@ public final class Slave implements Node, Serializable { /** * @stapler-constructor */ - public Slave(String name, String description, String remoteFS, String numExecutors, - Mode mode, String label) throws FormException { + public Slave(String name, String description, String command, String remoteFS, String numExecutors, Mode mode, + String label) throws FormException { this.name = name; this.description = description; this.numExecutors = Util.tryParseNumber(numExecutors, 1).intValue(); this.mode = mode; + this.agentCommand = command; this.remoteFS = remoteFS; this.label = Util.fixNull(label).trim(); getAssignedLabels(); // compute labels now @@ -127,12 +126,8 @@ public final class Slave implements Node, Serializable { throw new FormException(Messages.Slave_InvalidConfig_Executors(name), null); } - public SlaveStartMethod getStartMethod() { - return startMethod == null ? new JNLPStartMethod() : startMethod; - } - - public void setStartMethod(SlaveStartMethod startMethod) { - this.startMethod = startMethod; + public String getCommand() { + return agentCommand; } public String getRemoteFS() { @@ -155,14 +150,6 @@ public final class Slave implements Node, Serializable { return mode; } - public SlaveAvailabilityStrategy getAvailabilityStrategy() { - return availabilityStrategy == null ? new SlaveAvailabilityStrategy.Always() : availabilityStrategy; - } - - public void setAvailabilityStrategy(SlaveAvailabilityStrategy availabilityStrategy) { - this.availabilityStrategy = availabilityStrategy; - } - public String getLabelString() { return Util.fixNull(label).trim(); } @@ -316,14 +303,15 @@ public final class Slave implements Node, Serializable { } @Override - @Deprecated public boolean isJnlpAgent() { - return getNode().getStartMethod() instanceof JNLPStartMethod; + return getNode().getCommand().length()==0; } - @Override - public boolean isStartSupported() { - return getNode().getStartMethod().isStartSupported(); + /** + * Gets the formatted current time stamp. + */ + private static String getTimestamp() { + return String.format("[%1$tD %1$tT]",new Date()); } /** @@ -333,7 +321,53 @@ public final class Slave implements Node, Serializable { closeChannel(); final OutputStream launchLog = openLogFile(); - slave.startMethod.start(this, slave, launchLog, logger); + + if(slave.agentCommand.length()>0) { + // launch the slave agent asynchronously + threadPoolForRemoting.execute(new Runnable() { + // TODO: do this only for nodes that are so configured. + // TODO: support passive connection via JNLP + public void run() { + final StreamTaskListener listener = new StreamTaskListener(launchLog); + try { + listener.getLogger().println(Messages.Slave_Launching(getTimestamp())); + listener.getLogger().println("$ "+slave.agentCommand); + + ProcessBuilder pb = new ProcessBuilder(Util.tokenize(slave.agentCommand)); + final EnvVars cookie = ProcessTreeKiller.createCookie(); + pb.environment().putAll(cookie); + final Process proc = pb.start(); + + // capture error information from stderr. this will terminate itself + // when the process is killed. + new StreamCopyThread("stderr copier for remote agent on "+slave.getNodeName(), + proc.getErrorStream(), launchLog).start(); + + setChannel(proc.getInputStream(),proc.getOutputStream(),launchLog,new Listener() { + public void onClosed(Channel channel, IOException cause) { + if(cause!=null) + cause.printStackTrace(listener.error(Messages.Slave_Terminated(getTimestamp()))); + ProcessTreeKiller.get().kill(proc,cookie); + } + }); + + logger.info("slave agent launched for "+slave.getNodeName()); + numRetryAttempt=0; + } catch (InterruptedException e) { + e.printStackTrace(listener.error("aborted")); + } catch (IOException e) { + Util.displayIOException(e,listener); + + String msg = Util.getWin32ErrorMessage(e); + if(msg==null) msg=""; + else msg=" : "+msg; + msg = Messages.Slave_UnableToLaunch(slave.getNodeName(),msg); + logger.log(Level.SEVERE,msg,e); + e.printStackTrace(listener.error(msg)); + } + } + }); + } } public OutputStream openLogFile() { @@ -357,7 +391,7 @@ public final class Slave implements Node, Serializable { if(this.channel!=null) throw new IllegalStateException("Already connected"); - Channel channel = new Channel(nodeName,threadPoolForRemoting, Channel.Mode.NEGOTIATE, + Channel channel = new Channel(nodeName,threadPoolForRemoting, Channel.Mode.NEGOTIATE, in,out, launchLog); channel.addListener(new Listener() { public void onClosed(Channel c,IOException cause) { @@ -558,11 +592,6 @@ public final class Slave implements Node, Serializable { if(command.length()>0) command += ' '; agentCommand = command+"java -jar ~/bin/slave.jar"; } - if (startMethod == null) { - startMethod = (agentCommand == null || agentCommand.trim().length() == 0) - ? new JNLPStartMethod() - : new CommandStartMethod(agentCommand); - } return this; } @@ -582,126 +611,6 @@ public final class Slave implements Node, Serializable { private static final long serialVersionUID = 1L; } - public static class JNLPStartMethod extends SlaveStartMethod { - - @Override - public boolean isStartSupported() { - return false; - } - - public void start(ComputerImpl computer, Slave slave, OutputStream launchLog, Logger logger) { - // do nothing as we cannot self start - } - - //@DataBoundConstructor - public JNLPStartMethod() { - } - - public Descriptor getDescriptor() { - return DESCRIPTOR; - } - - public static final Descriptor DESCRIPTOR = new Descriptor(JNLPStartMethod.class) { - public String getDisplayName() { - return "Launch slave agents via JNLP"; - } - - public SlaveStartMethod newInstance(StaplerRequest req, JSONObject formData) throws FormException { - return new JNLPStartMethod(); - } - }; - } - - public static class CommandStartMethod extends SlaveStartMethod { - - /** - * Command line to launch the agent, like - * "ssh myslave java -jar /path/to/hudson-remoting.jar" - */ - private String agentCommand; - - @DataBoundConstructor - public CommandStartMethod(String command) { - this.agentCommand = command; - } - - public String getCommand() { - return agentCommand; - } - - public Descriptor getDescriptor() { - return DESCRIPTOR; - } - - public static final Descriptor DESCRIPTOR = new Descriptor(CommandStartMethod.class) { - public String getDisplayName() { - return "Launch slave via execution of command on the Master"; - } - - }; - - /** - * Gets the formatted current time stamp. - */ - private static String getTimestamp() { - return String.format("[%1$tD %1$tT]", new Date()); - } - - public void start(final ComputerImpl computer, final Slave slave, final OutputStream launchLog, - final Logger logger) { - final CommandStartMethod method = (CommandStartMethod) slave.startMethod; - // launch the slave agent asynchronously - Computer.threadPoolForRemoting.execute(new Runnable() { - // TODO: do this only for nodes that are so configured. - // TODO: support passive connection via JNLP - public void run() { - final StreamTaskListener listener = new StreamTaskListener(launchLog); - try { - listener.getLogger().println(Messages.Slave_Launching(getTimestamp())); - listener.getLogger().println("$ " + method.getCommand()); - - ProcessBuilder pb = new ProcessBuilder(Util.tokenize(method.getCommand())); - final EnvVars cookie = ProcessTreeKiller.createCookie(); - pb.environment().putAll(cookie); - final Process proc = pb.start(); - - // capture error information from stderr. this will terminate itself - // when the process is killed. - new StreamCopyThread("stderr copier for remote agent on " + slave.getNodeName(), - proc.getErrorStream(), launchLog).start(); - - computer.setChannel(proc.getInputStream(), proc.getOutputStream(), launchLog, new Listener() { - public void onClosed(Channel channel, IOException cause) { - if (cause != null) { - cause.printStackTrace( - listener.error(Messages.Slave_Terminated(getTimestamp()))); - } - ProcessTreeKiller.get().kill(proc, cookie); - } - }); - - logger.info("slave agent launched for " + slave.getNodeName()); - computer.numRetryAttempt = 0; - } catch (InterruptedException e) { - e.printStackTrace(listener.error("aborted")); - } catch (IOException e) { - Util.displayIOException(e, listener); - - String msg = Util.getWin32ErrorMessage(e); - if (msg == null) { - msg = ""; - } else { - msg = " : " + msg; - } - msg = Messages.Slave_UnableToLaunch(slave.getNodeName(), msg); - logger.log(Level.SEVERE, msg, e); - e.printStackTrace(listener.error(msg)); - } - } - }); - } - } - // // backwrad compatibility // @@ -721,28 +630,4 @@ public final class Slave implements Node, Serializable { * @deprecated */ private transient String command; - /** - * Command line to launch the agent, like - * "ssh myslave java -jar /path/to/hudson-remoting.jar" - */ - private transient String agentCommand; - - static { - SlaveStartMethod.LIST.add(Slave.JNLPStartMethod.DESCRIPTOR); - SlaveStartMethod.LIST.add(Slave.CommandStartMethod.DESCRIPTOR); - } - - -// static { -// ConvertUtils.register(new Converter(){ -// public Object convert(Class type, Object value) { -// if (value != null) { -// System.out.println("CVT: " + type + " from (" + value.getClass() + ") " + value); -// } else { -// System.out.println("CVT: " + type + " from " + value); -// } -// return null; //To change body of implemented methods use File | Settings | File Templates. -// } -// }, SlaveStartMethod.class); -// } } diff --git a/core/src/main/java/hudson/model/SlaveAvailabilityStrategy.java b/core/src/main/java/hudson/model/SlaveAvailabilityStrategy.java deleted file mode 100644 index 9d3990994f..0000000000 --- a/core/src/main/java/hudson/model/SlaveAvailabilityStrategy.java +++ /dev/null @@ -1,79 +0,0 @@ -package hudson.model; - -import hudson.util.DescriptorList; -import hudson.ExtensionPoint; -import org.kohsuke.stapler.StaplerRequest; -import net.sf.json.JSONObject; - -/** - * Slave availability strategy - */ -public abstract class SlaveAvailabilityStrategy implements Describable, ExtensionPoint { - - /** - * This method will be called periodically to allow this strategy to decide what to do with it's owning slave. - * The default implementation takes the slave on-line every time it's off-line. - * - * @param slave The slave that owns this strategy, i.e. {@code slave.getAvailabilityStrategy() == this} - * @param state Some state information that may be useful in deciding what to do. - * @return The number of minutes after which the strategy would like to be checked again. The strategy may be - * rechecked earlier or later that this! - */ - public long check(Slave slave, State state) { - Slave.ComputerImpl c = slave.getComputer(); - if (c != null && c.isOffline() && c.isStartSupported()) - c.tryReconnect(); - return 5; - } - - /** - * All registered {@link SlaveAvailabilityStrategy} implementations. - */ - public static final DescriptorList LIST = new DescriptorList( - Always.DESCRIPTOR - ); - - public static class State { - private final boolean jobWaiting; - private final boolean jobRunning; - - public State(boolean jobWaiting, boolean jobRunning) { - this.jobWaiting = jobWaiting; - this.jobRunning = jobRunning; - } - - public boolean isJobWaiting() { - return jobWaiting; - } - - public boolean isJobRunning() { - return jobRunning; - } - } - - public static class Always extends SlaveAvailabilityStrategy { - - public Descriptor getDescriptor() { - return DESCRIPTOR; - } - - public static final Descriptor DESCRIPTOR = - new DescriptorImpl(); - - private static class DescriptorImpl extends Descriptor { - public DescriptorImpl() { - super(Always.class); - } - - public String getDisplayName() { - return "Keep this slave on-line as much as possible"; - } - - public SlaveAvailabilityStrategy newInstance(StaplerRequest req, JSONObject formData) throws FormException { - return new Always(); - } - - - } - } -} diff --git a/core/src/main/java/hudson/model/SlaveReconnectionWork.java b/core/src/main/java/hudson/model/SlaveReconnectionWork.java index b696144f3c..3e3f562cee 100644 --- a/core/src/main/java/hudson/model/SlaveReconnectionWork.java +++ b/core/src/main/java/hudson/model/SlaveReconnectionWork.java @@ -1,38 +1,21 @@ package hudson.model; import hudson.model.Slave.ComputerImpl; -import static hudson.model.SlaveAvailabilityStrategy.*; import hudson.triggers.SafeTimerTask; -import java.util.Map; -import java.util.WeakHashMap; - /** * Periodically checks the slaves and try to reconnect dead slaves. - * + * * @author Kohsuke Kawaguchi */ public class SlaveReconnectionWork extends SafeTimerTask { protected void doRun() { - // use a weak hashmap - Map nextCheck = new WeakHashMap(); - for (Slave s : Hudson.getInstance().getSlaves()) { - if (!nextCheck.containsKey(s) || System.currentTimeMillis() > nextCheck.get(s)) { - final Queue queue = Hudson.getInstance().getQueue(); - boolean hasJob = false; - for (Executor exec: s.getComputer().getExecutors()) { - if (!exec.isIdle()) { - hasJob = true; - break; - } - } - // TODO get only the items from the queue that can apply to this slave - State state = new State(queue.getItems().length > 0, hasJob); - // at the moment I don't trust strategies to wait more than 60 minutes - // strategies need to wait at least one minute - final long waitInMins = Math.min(1, Math.max(60, s.getAvailabilityStrategy().check(s, state))); - nextCheck.put(s, System.currentTimeMillis() + 60 * 1000 * waitInMins); - } + for(Slave s : Hudson.getInstance().getSlaves()) { + ComputerImpl c = s.getComputer(); + if(c==null) // shouldn't happen, but let's be defensive + continue; + if(c.isOffline() && !c.isJnlpAgent()) + c.tryReconnect(); } } } diff --git a/core/src/main/java/hudson/model/SlaveStartMethod.java b/core/src/main/java/hudson/model/SlaveStartMethod.java index ce911853eb..49ff035c8d 100644 --- a/core/src/main/java/hudson/model/SlaveStartMethod.java +++ b/core/src/main/java/hudson/model/SlaveStartMethod.java @@ -1,8 +1,6 @@ package hudson.model; import hudson.ExtensionPoint; -import hudson.security.SecurityRealm; -import hudson.util.DescriptorList; import java.util.List; import java.util.ArrayList; @@ -26,8 +24,5 @@ public abstract class SlaveStartMethod implements Describable, public abstract void start(Slave.ComputerImpl computer, Slave slave, OutputStream launchLog, Logger logger); - /** - * All registered {@link SlaveStartMethod} implementations. - */ - public static final DescriptorList LIST = new DescriptorList(); + public static final List> LIST = new ArrayList>(); } diff --git a/core/src/main/java/hudson/triggers/Trigger.java b/core/src/main/java/hudson/triggers/Trigger.java index 897c98bd8c..90ffcf7ab8 100644 --- a/core/src/main/java/hudson/triggers/Trigger.java +++ b/core/src/main/java/hudson/triggers/Trigger.java @@ -206,18 +206,17 @@ public abstract class Trigger implements Describable> public static final Timer timer = new Timer("Hudson cron thread"); public static void init() { - long MIN = 1000*60; - long HOUR =60*MIN; - long DAY = 24*HOUR; - - timer.scheduleAtFixedRate(new Cron(), MIN, MIN); + timer.scheduleAtFixedRate(new Cron(), 1000*60, 1000*60/*every minute*/); new DoubleLaunchChecker().schedule(); // clean up fingerprint once a day + long MIN = 1000*60; + long HOUR =60*MIN; + long DAY = 24*HOUR; timer.scheduleAtFixedRate(new FingerprintCleanupThread(),DAY,DAY); timer.scheduleAtFixedRate(new WorkspaceCleanupThread(),DAY+4*HOUR,DAY); - timer.scheduleAtFixedRate(new SlaveReconnectionWork(),15*MIN,1*MIN); + timer.scheduleAtFixedRate(new SlaveReconnectionWork(),15*MIN,5*MIN); // start monitoring nodes, although there's no hurry. timer.schedule(new SafeTimerTask() { diff --git a/core/src/main/resources/hudson/model/Computer/index.jelly b/core/src/main/resources/hudson/model/Computer/index.jelly index 7565a97a2f..2bcaf39dfb 100644 --- a/core/src/main/resources/hudson/model/Computer/index.jelly +++ b/core/src/main/resources/hudson/model/Computer/index.jelly @@ -25,7 +25,7 @@

- TCP port for JNLP slave agents is disabled. + TCP port for JNLP slave agentsis is disabled. Go to system config screen and change it.
diff --git a/core/src/main/resources/hudson/model/Hudson/configure.jelly b/core/src/main/resources/hudson/model/Hudson/configure.jelly index f282fd3424..3cd623ff31 100644 --- a/core/src/main/resources/hudson/model/Hudson/configure.jelly +++ b/core/src/main/resources/hudson/model/Hudson/configure.jelly @@ -12,6 +12,10 @@ + + + @@ -52,6 +56,55 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+
+
+
+
+ diff --git a/core/src/main/resources/hudson/model/Hudson/configureExecutors.jelly b/core/src/main/resources/hudson/model/Hudson/configureExecutors.jelly index e4748274b1..d8bbf09da4 100644 --- a/core/src/main/resources/hudson/model/Hudson/configureExecutors.jelly +++ b/core/src/main/resources/hudson/model/Hudson/configureExecutors.jelly @@ -80,29 +80,25 @@ +

${d}, ${d.class.name}, ${d == null}

- - - - - - - - - - - - - + + + + + +
+
+
diff --git a/core/src/main/resources/hudson/model/Hudson/manage.jelly b/core/src/main/resources/hudson/model/Hudson/manage.jelly index 83272b6267..36172c4449 100644 --- a/core/src/main/resources/hudson/model/Hudson/manage.jelly +++ b/core/src/main/resources/hudson/model/Hudson/manage.jelly @@ -20,8 +20,7 @@

${%Manage Hudson}

- - + ${%Discard all the loaded data in memory and reload everything from file system.} ${%Useful when you modified config files directly on disk.} diff --git a/core/src/main/resources/hudson/model/SlaveAvailabilityStrategy/config.jelly b/core/src/main/resources/hudson/model/Node/Availability/ALWAYS.jelly similarity index 100% rename from core/src/main/resources/hudson/model/SlaveAvailabilityStrategy/config.jelly rename to core/src/main/resources/hudson/model/Node/Availability/ALWAYS.jelly diff --git a/core/src/main/resources/hudson/model/SlaveAvailabilityStrategy/Demand/config.jelly b/core/src/main/resources/hudson/model/Node/Availability/DEMAND.jelly similarity index 100% rename from core/src/main/resources/hudson/model/SlaveAvailabilityStrategy/Demand/config.jelly rename to core/src/main/resources/hudson/model/Node/Availability/DEMAND.jelly diff --git a/core/src/main/resources/hudson/model/SlaveAvailabilityStrategy/Scheduled/config.jelly b/core/src/main/resources/hudson/model/Node/Availability/SCHEDULED.jelly similarity index 100% rename from core/src/main/resources/hudson/model/SlaveAvailabilityStrategy/Scheduled/config.jelly rename to core/src/main/resources/hudson/model/Node/Availability/SCHEDULED.jelly diff --git a/core/src/main/resources/hudson/model/Slave/CommandStartMethod/config.jelly b/core/src/main/resources/hudson/model/Slave/CommandStartMethod/config.jelly deleted file mode 100644 index 96ac592652..0000000000 --- a/core/src/main/resources/hudson/model/Slave/CommandStartMethod/config.jelly +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/core/src/main/resources/hudson/model/Slave/CommandStartMethod/config_ja.properties b/core/src/main/resources/hudson/model/Slave/CommandStartMethod/config_ja.properties deleted file mode 100644 index 4cfe2527c3..0000000000 --- a/core/src/main/resources/hudson/model/Slave/CommandStartMethod/config_ja.properties +++ /dev/null @@ -1 +0,0 @@ -launch\ command=\u8d77\u52d5\u30b3\u30de\u30f3\u30c9 \ No newline at end of file diff --git a/core/src/main/resources/hudson/model/Slave/JNLPStartMethod/config.jelly b/core/src/main/resources/hudson/model/Slave/JNLPStartMethod/config.jelly deleted file mode 100644 index 969ce5e50d..0000000000 --- a/core/src/main/resources/hudson/model/Slave/JNLPStartMethod/config.jelly +++ /dev/null @@ -1,2 +0,0 @@ - - \ No newline at end of file diff --git a/core/src/main/resources/lib/form/dropdownList.jelly b/core/src/main/resources/lib/form/dropdownList.jelly index e273f953d2..01ec3b2a10 100644 --- a/core/src/main/resources/lib/form/dropdownList.jelly +++ b/core/src/main/resources/lib/form/dropdownList.jelly @@ -4,51 +4,30 @@ @name (mandatory) name of the drop-down list. --> - + - - - - - - - - - - - - -
- ${attrs.title} - - - - - - Help for feature: ${title} -
- - -
- - - + + + + - - - ${description} - - - - - + + + + + + + +
+
+ + + diff --git a/debian/rules b/debian/rules index f255df69a4..18095d01dd 100755 --- a/debian/rules +++ b/debian/rules @@ -45,6 +45,7 @@ install: build # Add here commands to install the package into debian/hudson. mkdir -p $(CURDIR)/debian/hudson/usr/local/hudson cp hudson.war $(CURDIR)/debian/hudson/usr/local/hudson/hudson.war + cp debian/hudson.bin $(CURDIR)/debian/hudson/usr/sbin/hudson diff --git a/war/resources/help/system-config/master-slave/availability.html b/war/resources/help/system-config/master-slave/availability.html deleted file mode 100644 index 491b0bbe6b..0000000000 --- a/war/resources/help/system-config/master-slave/availability.html +++ /dev/null @@ -1,46 +0,0 @@ -
- Controls when Hudson starts and stops the slave. - -
-
- Keep this slave on-line as much as possible -
-
- This is the default and normal setting. - In this mode, Hudson uses tries to keep the slave on-line. - If Hudson can start the slave without user assistance, it will periodically - attempt to restart the slave if it is unavailable. - Hudson will not take the slave off-line. -
- -
- Take this slave on-line and off-line at specific times -
-
- In this mode, Hudson will keep the slave on-line according to the configured schedule. - If Hudson can start the slave without user assistance, it will periodically - attempt to start the slave if it is unavailable during an on-line window. - - During an off-line window, the slave will only be taken off-line if there are no active - jobs running on the slave. -
- -
- Take this slave on-line and off-line as needed -
-
- In this mode, if Hudson can start the slave without user assistance, it will periodically - attempt to start the slave while there are unexecuted jobs which meet the following criteria: -
    -
  • They have been in the queue for at least the specified startup demand period
  • -
  • They can execute on this slave
  • -
- - The slave will be taken off-line if: -
    -
  • There are no active jobs running on the slave
  • -
  • The slave has been idle for at least the specified idle period
  • -
-
-
-
\ No newline at end of file diff --git a/war/resources/help/system-config/master-slave/startMethod.html b/war/resources/help/system-config/master-slave/startMethod.html deleted file mode 100644 index b4082d11b7..0000000000 --- a/war/resources/help/system-config/master-slave/startMethod.html +++ /dev/null @@ -1,3 +0,0 @@ -
- Controls how Hudson starts the slave. -
\ No newline at end of file