当前位置: 首页>>代码示例>>Java>>正文


Java Jenkins.removeNode方法代码示例

本文整理汇总了Java中jenkins.model.Jenkins.removeNode方法的典型用法代码示例。如果您正苦于以下问题:Java Jenkins.removeNode方法的具体用法?Java Jenkins.removeNode怎么用?Java Jenkins.removeNode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在jenkins.model.Jenkins的用法示例。


在下文中一共展示了Jenkins.removeNode方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: removeNode

import jenkins.model.Jenkins; //导入方法依赖的package包/类
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);
            }
        }
    }
}
 
开发者ID:awslabs,项目名称:ec2-spot-jenkins-plugin,代码行数:17,代码来源:EC2FleetCloud.java

示例2: addNewSlave

import jenkins.model.Jenkins; //导入方法依赖的package包/类
private void addNewSlave(final AmazonEC2 ec2, final String instanceId) throws Exception {
    // Generate a random FS root if one isn't specified
    String fsRoot = this.fsRoot;
    if (fsRoot == null || fsRoot.equals("")) {
        fsRoot = "/tmp/jenkins-"+UUID.randomUUID().toString().substring(0, 8);
    }

    final DescribeInstancesResult result=ec2.describeInstances(
            new DescribeInstancesRequest().withInstanceIds(instanceId));
    if (result.getReservations().isEmpty()) //Can't find this instance, skip it
        return;
    final Instance instance=result.getReservations().get(0).getInstances().get(0);
    final String address = isPrivateIpUsed() ?
            instance.getPrivateIpAddress() : instance.getPublicIpAddress();

    // Check if we have the address to use. Nodes don't get it immediately.
    if (address == null)
        return; // Wait some more...

    final FleetNode slave = new FleetNode(instanceId, "Fleet slave for" + instanceId,
            fsRoot, this.numExecutors.toString(), Node.Mode.NORMAL, this.labelString, new ArrayList<NodeProperty<?>>(),
            FLEET_CLOUD_ID, computerConnector.launch(address, TaskListener.NULL));

    // Initialize our retention strategy
    if (getIdleMinutes() != null)
        slave.setRetentionStrategy(new IdleRetentionStrategy(getIdleMinutes(), this));

    final Jenkins jenkins=Jenkins.getInstance();
    //noinspection SynchronizationOnLocalVariableOrMethodParameter
    synchronized (jenkins) {
        // Try to avoid duplicate nodes
        final Node n = jenkins.getNode(instanceId);
        if (n != null)
            jenkins.removeNode(n);
        jenkins.addNode(slave);
    }

    //A new node, wheee!
    instancesSeen.add(instanceId);
    if (!plannedNodes.isEmpty())
    {
        //If we're waiting for a new node - mark it as ready
        final NodeProvisioner.PlannedNode curNode=plannedNodes.iterator().next();
        plannedNodes.remove(curNode);
        ((SettableFuture<Node>)curNode.future).set(slave);
    }
}
 
开发者ID:awslabs,项目名称:ec2-spot-jenkins-plugin,代码行数:48,代码来源:EC2FleetCloud.java


注:本文中的jenkins.model.Jenkins.removeNode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。