Handle pending writes for the given node.

@param node the node to handle writes for.
@throws IOException can be raised during writing failures.
182835
private void handleWrites(final MemcachedNode node) throws IOException {
    node.fillWriteBuffer(shouldOptimize);
    boolean canWriteMore = node.getBytesRemainingToWrite() > 0;
    while (canWriteMore) {
      int wrote = node.writeSome();
      metrics.updateHistogram(OVERALL_AVG_BYTES_WRITE_METRIC, wrote);
      node.fillWriteBuffer(shouldOptimize);
      canWriteMore = wrote > 0 && node.getBytesRemainingToWrite() > 0;
    }
  }
1130780
public void write(ObjectWriter out, PersistedNodeData nodeData) throws IOException
   {
      // write id
      out.writeInt(SerializationConstants.PERSISTED_NODE_DATA);

      // TransientItemData
      out.writeString(nodeData.getQPath().getAsString());
      out.writeString(nodeData.getIdentifier());

      if (nodeData.getParentIdentifier() != null)
      {
         out.writeByte(SerializationConstants.NOT_NULL_DATA);
         out.writeString(nodeData.getParentIdentifier());
      }
      else
         out.writeByte(SerializationConstants.NULL_DATA);

      out.writeInt(nodeData.getPersistedVersion());
      // -------------------

      out.writeInt(nodeData.getOrderNumber());

      // primary type
      out.writeString(nodeData.getPrimaryTypeName().getAsString());

      // mixins
      InternalQName[] mixinNames = nodeData.getMixinTypeNames();

      if (mixinNames != null)
      {
         out.writeByte(SerializationConstants.NOT_NULL_DATA);
         out.writeInt(mixinNames.length);
         for (int i = 0; i < mixinNames.length; i++)
         {
            out.writeString(mixinNames[i].getAsString());
         }
      }
      else
      {
         out.writeByte(SerializationConstants.NULL_DATA);
      }

      ACLWriter wr = new ACLWriter();

      AccessControlList acl = nodeData.getACL();
      if (acl != null)
      {
         out.writeByte(SerializationConstants.NOT_NULL_DATA);
         wr.write(out, acl);
      }
      else
      {
         out.writeByte(SerializationConstants.NULL_DATA);
      }
   }
813341
public Writer writeTo(final Writer out) throws IOException {
        final Iterator iter = nodeIterator();
        while (iter.hasNext()) {
            ((Node) iter.next()).writeTo(out);
        }
        return out;
    }
79616
public void write(String s) throws IOException {
	    if (writer != null) {
	        writer.write(s);
	    } else {
	        write(s, 0, s.length());
	    }
    }
108632
void stopDecommission(DatanodeDescriptor node)
    throws IOException {
    if ((node.isDecommissionInProgress() &&
      ((Monitor) dnthread.getRunnable()).stopDecommission(node)) ||
      node.isDecommissioned()) {
      LOG.info("Stop Decommissioning node " + node.getName());
      synchronized (heartbeats) {
        updateStats(node, false);
        node.stopDecommission();
        updateStats(node, true);
      }

      // Make sure we process over replicated blocks.
      writeLock();
      try {
        Iterator<BlockInfo> it = node.getBlockIterator();
        while (it.hasNext()) {
          Block b = it.next();
          if (countLiveNodes(b) > getReplication(b)) {
            overReplicatedBlocks.add(b);
          }
        }
      } finally {
        writeUnlock();
      }
    }
  }
691624
public void write(List<NodeTypeData> nodeTypes, OutputStream os) throws RepositoryException
   {
      OutputStreamWriter out = new OutputStreamWriter(os);
      try
      {
         for (NodeTypeData nodeType : nodeTypes)
         {
            printNamespaces(nodeType, out);
            printNodeTypeDeclaration(nodeType, out);
         }
         out.close();
      }
      catch (IOException e)
      {
         throw new RepositoryException(e.getMessage(), e);
      }

   }
315039
public void onNodeStarted(final IExecutionNode node) {

        if (!node.equals(this.theLastNode)) {

            if (this.theLastNode != null) {
                printStarted("Starting: " + format(this.theLastNode));
            }

            this.theLastNode = node;
        } else {
            // not sure how this would happen
            printStarted("Starting: " + format(node));
        }

    }
8420
public void write(Writer out)
         throws IOException
    {
        writeHtmlHead(out);
        writeBodyTag(out);
        writeElements(out);
        writeHtmlEnd(out);
    }
72662
private void putNodeToStore(final Node<K, V> node) {
		final int nodeid = node.id;
		final int index = (nodeid < 0 ? -nodeid : nodeid);
		final WriteBuffer wbuf = storage.set(index);
		final ByteBuffer buf = wbuf.buf();
		if (node.isDeleted()) { 	// This block is for delete
			if (cleanBlocksOnFree) {
				buf.clear();
				int cx = (blockSize >> 3); // division by 8
				while (cx-- > 0) {
					buf.putLong(0);	// Fill with zeroes
				}
				buf.flip();
			} else {
				node.clean(buf); 	// Generate zeroed minimal buffer
			}
			freeBlocks.set(index); 	// Mark block as free
		} else {
			node.serialize(buf);
		}
		wbuf.save();
		if (enableDirtyCheck) {
			dirtyCheck.clear(index);
		}
		if (enableIOStats) {
			getIOStat(nodeid).incPhysWrite();
		}
	}
235928
private void handleDeadNode(String nodeName, Set<String> sessions) {
    LOG.info("Notify sessions: " + sessions + " about dead node " + nodeName);
    for (String session : sessions) {
      sessionNotifier.notifyDeadNode(session, nodeName);
    }
  }
728546
private void removeNode(Node node)
	{
		result.remove(node);

		for (Edge edge : node.getUpstream())
		{
			result.remove(edge);
		}

		for (Edge edge : node.getDownstream())
		{
			result.remove(edge);
		}
	}
1298540
private void writeNode(Node node) {
        try {
            this.pStmtNodesC.setLong(1, node.getId());
            this.pStmtNodesC.setDouble(2, node.getLatitude());
            this.pStmtNodesC.setDouble(3, node.getLongitude());

            this.pStmtNodesC.addBatch();

            if (this.nNodes % BATCH_LIMIT == 0) {
                this.pStmtNodesC.executeBatch();

                this.pStmtNodesC.clearBatch();
            }
        } catch (SQLException e) {
            e.printStackTrace();
        }
    }
1368019
public void write(Writer out)
         throws IOException
    {
        out.write("<!--\n");
        super.write(out);
        out.write("\n-->");
    }
233712
static <K extends Comparable<K>> void checkNode(Node<K> node) {
        node.checkNode(null, null);
    }
1237937
public void setNodes(final @Nonnull Collection<? extends Node> nodes) throws IOException {
        Queue.withLock(new Runnable() {
            @Override
            public void run() {
                Set<String> toRemove = new HashSet<>(Nodes.this.nodes.keySet());
                for (Node n : nodes) {
                    final String name = n.getNodeName();
                    toRemove.remove(name);
                    Nodes.this.nodes.put(name, n);
                }
                Nodes.this.nodes.keySet().removeAll(toRemove); // directory clean up will be handled by save
                jenkins.updateComputerList();
                jenkins.trimLabels();
            }
        });
        save();
    }
537746
public void onNodeIgnored(final IExecutionNode node) {

        final Description description = descriptionMap.get(Long.valueOf(node.getId()));
        notifyTestIgnored(description);

    }
847549
public void write(String text) throws IOException {
        file.getParentFile().mkdirs();
        AtomicFileWriter w = new AtomicFileWriter(file);
        try {
            w.write(text);
            w.commit();
        } finally {
            w.abort();
        }
    }