提交 8b8ff2fb 编写于 作者: K kohsuke

more renaming

git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@9410 71c3de6d-444a-0410-be80-ed276b4c234a
上级 ce2614e1
......@@ -1524,11 +1524,10 @@ public final class Hudson extends View implements ItemGroup<TopLevelItem>, Node,
private Slave newSlave(StaplerRequest req, JSONObject j) throws FormException {
final ComputerStartMethod startMethod = newDescribedChild(req, j, "startMethod", ComputerStartMethod.LIST);
final RetentionStrategy availabilityStrategy =
newDescribedChild(req, j, "availabilityStrategy", RetentionStrategy.LIST);
final RetentionStrategy retentionStrategy = newDescribedChild(req, j, "availabilityStrategy", RetentionStrategy.LIST);
final Slave slave = req.bindJSON(Slave.class, j);
slave.setStartMethod(startMethod);
slave.setAvailabilityStrategy(availabilityStrategy);
slave.setRetentionStrategy(retentionStrategy);
return slave;
}
......
......@@ -66,7 +66,7 @@ public final class Slave implements Node, Serializable {
/**
* Slave availablility strategy.
*/
private RetentionStrategy availabilityStrategy;
private RetentionStrategy retentionStrategy;
/**
* The starter that will startup this slave.
......@@ -142,12 +142,12 @@ public final class Slave implements Node, Serializable {
return mode;
}
public RetentionStrategy getAvailabilityStrategy() {
return availabilityStrategy == null ? RetentionStrategy.Always.INSTANCE : availabilityStrategy;
public RetentionStrategy getRetentionStrategy() {
return retentionStrategy == null ? RetentionStrategy.Always.INSTANCE : retentionStrategy;
}
public void setAvailabilityStrategy(RetentionStrategy availabilityStrategy) {
this.availabilityStrategy = availabilityStrategy;
public void setRetentionStrategy(RetentionStrategy availabilityStrategy) {
this.retentionStrategy = availabilityStrategy;
}
public String getLabelString() {
......
package hudson.slaves;
import hudson.ExtensionPoint;
import hudson.slaves.SlaveComputer;
import hudson.model.Describable;
import hudson.model.Computer;
import hudson.model.Describable;
import hudson.remoting.Channel.Listener;
import hudson.util.DescriptorList;
import hudson.util.StreamTaskListener;
......
......@@ -46,6 +46,7 @@ import javax.servlet.http.HttpServletResponse;
public final class SlaveComputer extends Computer {
private volatile Channel channel;
private Boolean isUnix;
private ComputerStartMethod startMethod;
/**
* Number of failed attempts to reconnect to this node
......@@ -82,24 +83,27 @@ public final class SlaveComputer extends Computer {
@Override
@Deprecated
public boolean isJnlpAgent() {
return getNode().getStartMethod() instanceof JNLPStartMethod;
return startMethod instanceof JNLPStartMethod;
}
@Override
public boolean isLaunchSupported() {
return getNode().getStartMethod().isLaunchSupported();
return startMethod.isLaunchSupported();
}
/**
* Launches a remote agent asynchronously.
*/
private void launch(final Slave slave) {
public ComputerStartMethod getStartMethod() {
return startMethod;
}
public void launch() {
if(channel!=null) return;
closeChannel();
Computer.threadPoolForRemoting.execute(new Runnable() {
public void run() {
// do this on another thread so that the lengthy launch operation
// (which is typical) won't block UI thread.
slave.getStartMethod().launch(SlaveComputer.this, new StreamTaskListener(openLogFile()));
startMethod.launch(SlaveComputer.this, new StreamTaskListener(openLogFile()));
}
});
}
......@@ -203,11 +207,6 @@ public final class SlaveComputer extends Computer {
}
}
public void launch() {
if(channel==null)
launch(getNode());
}
/**
* Gets the string representation of the slave log.
*/
......@@ -236,7 +235,7 @@ public final class SlaveComputer extends Computer {
}
public RetentionStrategy getRetentionStrategy() {
return getNode().getAvailabilityStrategy();
return getNode().getRetentionStrategy();
}
/**
......@@ -257,9 +256,10 @@ public final class SlaveComputer extends Computer {
@Override
protected void setNode(Node node) {
super.setNode(node);
if(channel==null)
// maybe the configuration was changed to relaunch the slave, so try it now.
launch((Slave)node);
startMethod = ((Slave)node).getStartMethod();
// maybe the configuration was changed to relaunch the slave, so try to re-launch now.
launch();
}
private static final Logger logger = Logger.getLogger(SlaveComputer.class.getName());
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册