code: public boolean updateNode(final @Nonnull Node node) throws IOException {
          boolean exists;
          try {
              exists = Queue.withLock(new Callable<Boolean>() {
                  @Override
                  public Boolean call() throws Exception {
                      if (node == nodes.get(node.getNodeName())) {
                          jenkins.trimLabels();
                          return true;
                      }
                      return false;
                  }
              });
          } catch (RuntimeException e) {
              // should never happen, but if it does let's do the right thing
              throw e;
          } catch (Exception e) {
              // can never happen
              exists = false;
          }
          if (exists) {
              // TODO there is a theoretical race whereby the node instance is updated/removed after lock release
              persistNode(node);
              return true;
          }
          return false;
      }
docs: Updates an existing node on disk. If the node instance is not in the list of nodes, then this
  will be a no-op, even if there is another instance with the same {@link Node#getNodeName()}.
  
  @param node the node to be updated.
  @return {@code true}, if the node was updated. {@code false}, if the node was not in the list of nodes.
  @throws IOException if the node could not be persisted.
  @since 1.634