本文整理了Java中jenkins.model.Jenkins.removeNode()
方法的一些代码示例,展示了Jenkins.removeNode()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Jenkins.removeNode()
方法的具体详情如下:
包路径:jenkins.model.Jenkins
类名称:Jenkins
方法名:removeNode
[英]Removes a Node from Jenkins.
[中]从Jenkins中删除一个节点。
代码示例来源:origin: jenkinsci/jenkins
/**
* Remove the node.
*
* <p>
* To actually deallocate the resource tied to this {@link Node}, implement {@link Computer#onRemoved()}.
*/
protected void kill(Node n) throws IOException {
Jenkins.get().removeNode(n);
}
代码示例来源:origin: jenkinsci/jenkins
/**
* Releases and removes this agent.
*/
public void terminate() throws InterruptedException, IOException {
final Computer computer = toComputer();
if (computer != null) {
computer.recordTermination();
}
try {
// TODO: send the output to somewhere real
_terminate(new StreamTaskListener(System.out, Charset.defaultCharset()));
} finally {
try {
Jenkins.get().removeNode(this);
} catch (IOException e) {
LOGGER.log(Level.WARNING, "Failed to remove "+name,e);
}
}
}
代码示例来源:origin: jenkinsci/jenkins
/**
* Really deletes the agent.
*/
@RequirePOST
public HttpResponse doDoDelete() throws IOException {
checkPermission(DELETE);
Node node = getNode();
if (node != null) {
Jenkins.getInstance().removeNode(node);
} else {
AbstractCIBase app = Jenkins.getInstance();
app.removeComputer(this);
}
return new HttpRedirect("..");
}
代码示例来源:origin: jenkinsci/docker-slaves-plugin
protected void terminate() {
try {
Jenkins.getInstance().removeNode(slave);
} catch (IOException e) {
e.printStackTrace();
}
}
/**
代码示例来源:origin: org.jenkins-ci.main/jenkins-core
/**
* Remove the node.
*
* <p>
* To actually deallocate the resource tied to this {@link Node}, implement {@link Computer#onRemoved()}.
*/
protected void kill(Node n) throws IOException {
Jenkins.getInstance().removeNode(n);
}
代码示例来源:origin: io.jenkins.plugins/docker-slaves
protected void terminate() {
try {
Jenkins.getActiveInstance().removeNode(slave);
} catch (IOException e) {
e.printStackTrace();
}
}
/**
代码示例来源:origin: jenkinsci/docker-plugin
protected void removeNode(DockerTransientNode dtn) throws IOException {
Jenkins.getInstance().removeNode(dtn);
}
代码示例来源:origin: jenkinsci/ec2-plugin
private void removeNode(EC2AbstractSlave ec2Slave) {
try {
Jenkins.getInstance().removeNode(ec2Slave);
} catch (IOException e) {
LOGGER.log(Level.WARNING, "Failed to remove node: " + ec2Slave.getInstanceId());
}
}
代码示例来源:origin: org.jenkins-ci.plugins/ec2
private void removeNode(EC2AbstractSlave ec2Slave) {
try {
Jenkins.getInstance().removeNode(ec2Slave);
} catch (IOException e) {
LOGGER.log(Level.WARNING, "Failed to remove node: " + ec2Slave.getInstanceId());
}
}
代码示例来源:origin: awslabs/ec2-spot-jenkins-plugin
private synchronized void removeNode(String instanceId) {
final Jenkins jenkins=Jenkins.getInstance();
//noinspection SynchronizationOnLocalVariableOrMethodParameter
synchronized (jenkins) {
// If this node is dying, remove it from Jenkins
final Node n = jenkins.getNode(instanceId);
if (n != null) {
try {
jenkins.removeNode(n);
} catch(final Exception ex) {
LOGGER.log(Level.WARNING, "Error removing node " + instanceId);
throw new IllegalStateException(ex);
}
}
}
}
代码示例来源:origin: jenkinsci/swarm-plugin
@Override
@SuppressFBWarnings("NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE")
public void afterDisconnect(SlaveComputer computer, TaskListener listener) {
final Slave node = computer.getNode();
if (node != null) {
try {
Jenkins.getInstance().removeNode(node);
} catch (IOException e) {
e.printStackTrace(listener.error(e.getMessage()));
}
} else {
listener.getLogger().printf("Could not remove node for %s as it appears to have been removed already%n",
computer);
}
}
};
代码示例来源:origin: jenkinsci/docker-slaves-plugin
void provisionFailed(Exception cause) {
if (executable instanceof Run) {
((Run) executable).setResult(Result.NOT_BUILT);
}
try {
Jenkins.getInstance().removeNode(this);
} catch (IOException e) {
e.printStackTrace();
}
throw new OneShotExecutorProvisioningException(cause);
}
代码示例来源:origin: io.jenkins.plugins/docker-slaves
void provisionFailed(Exception cause) {
if (executable instanceof Run) {
((Run) executable).setResult(Result.NOT_BUILT);
}
try {
Jenkins.getActiveInstance().removeNode(this);
} catch (IOException e) {
e.printStackTrace();
}
throw new OneShotExecutorProvisioningException(cause);
}
代码示例来源:origin: jenkinsci/docker-plugin
@Override
protected void finished(StepContext context) throws Exception {
final DockerTransientNode node = (DockerTransientNode) Jenkins.getInstance().getNode(nodeName);
if (node != null) {
TaskListener listener = context.get(TaskListener.class);
listener.getLogger().println("Terminating docker node ...");
node.terminate(listener);
Jenkins.getInstance().removeNode(node);
}
}
}
代码示例来源:origin: Netflix-Skunkworks/dynaslave-plugin
@Override
public void afterDisconnect(SlaveComputer computer, TaskListener listener) {
if (!Jenkins.getInstance().isTerminating()) {
try {
Jenkins.getInstance().removeNode(computer.getNode());
} catch (IOException e) {
LOG.log(Level.WARNING, "Error removing slave", e);
}
}
}
代码示例来源:origin: io.jenkins.plugins/docker-slaves
/**
* If item is canceled, remove the executor we created for it.
*/
@Override
public void onLeft(Queue.LeftItem item) {
if (item.isCancelled()) {
DockerSlaveAssignmentAction action = item.getAction(DockerSlaveAssignmentAction.class);
if( action == null) return;
Node slave = action.getAssignedNodeName();
if (slave == null) return;
try {
Jenkins.getActiveInstance().removeNode(slave);
} catch (Exception e) {
LOGGER.log(Level.SEVERE, "Failure to remove One-Shot Slave", e);
}
}
}
代码示例来源:origin: jenkinsci/docker-slaves-plugin
/**
* If item is canceled, remove the executor we created for it.
*/
@Override
public void onLeft(Queue.LeftItem item) {
if (item.isCancelled()) {
DockerSlaveAssignmentAction action = item.getAction(DockerSlaveAssignmentAction.class);
if( action == null) return;
Node slave = action.getAssignedNodeName();
if (slave == null) return;
try {
Jenkins.getInstance().removeNode(slave);
} catch (Exception e) {
LOGGER.log(Level.SEVERE, "Failure to remove One-Shot Slave", e);
}
}
}
代码示例来源:origin: KostyaSha/yet-another-docker-plugin
@Override
public void terminate() throws InterruptedException, IOException {
try {
_terminate(getListener());
} finally {
try {
Jenkins.getInstance().removeNode(this);
} catch (IOException e) {
LOG.warn("Failed to remove {}", name, e);
getListener().error("Failed to remove " + name);
}
}
}
代码示例来源:origin: jenkinsci/mesos-plugin
/**
* Delete the slave, terminate the instance. Can be called either by doDoDelete() or from MesosRetentionStrategy.
*
* @throws InterruptedException
*/
public void deleteSlave() throws IOException, InterruptedException {
LOGGER.info("Terminating " + getName() + " slave");
MesosSlave slave = getNode();
// Slave already deleted
if (slave == null) return;
VirtualChannel channel = slave.getChannel();
if (channel != null) {
channel.close();
}
slave.terminate();
getJenkins().removeNode(slave);
}
代码示例来源:origin: org.jenkins-ci.main/jenkins-core
/**
* Really deletes the agent.
*/
@RequirePOST
public HttpResponse doDoDelete() throws IOException {
checkPermission(DELETE);
Node node = getNode();
if (node != null) {
Jenkins.getInstance().removeNode(node);
} else {
AbstractCIBase app = Jenkins.getInstance();
app.removeComputer(this);
}
return new HttpRedirect("..");
}
内容来源于网络,如有侵权,请联系作者删除!