Пример #1
0
  /** Replaces the current {@link Node} by another one. */
  private void replaceBy(Node newNode) throws ServletException, IOException {
    final Jenkins app = Jenkins.getInstance();

    // replace the old Node object by the new one
    synchronized (app) {
      List<Node> nodes = new ArrayList<Node>(app.getNodes());
      int i = nodes.indexOf(getNode());
      if (i < 0) {
        throw new IOException(
            "This slave appears to be removed while you were editing the configuration");
      }

      nodes.set(i, newNode);
      app.setNodes(nodes);
    }
  }