Exemplo n.º 1
0
 /** {@inheritDoc} */
 @Override
 public void save() throws IOException {
   if (BulkChange.contains(this)) {
     return;
   }
   final File nodesDir = getNodesDir();
   final Set<String> existing = new HashSet<String>();
   for (Node n : nodes.values()) {
     if (n instanceof EphemeralNode) {
       continue;
     }
     existing.add(n.getNodeName());
     XmlFile xmlFile =
         new XmlFile(Jenkins.XSTREAM, new File(new File(nodesDir, n.getNodeName()), "config.xml"));
     xmlFile.write(n);
     SaveableListener.fireOnChange(this, xmlFile);
   }
   for (File forDeletion :
       nodesDir.listFiles(
           new FileFilter() {
             @Override
             public boolean accept(File pathname) {
               return pathname.isDirectory() && !existing.contains(pathname.getName());
             }
           })) {
     Util.deleteRecursive(forDeletion);
   }
 }
Exemplo n.º 2
0
 public void save() throws IOException {
   if (BulkChange.contains(this)) return;
   try {
     getConfigFile().write(this);
     SaveableListener.fireOnChange(this, getConfigFile());
   } catch (IOException e) {
     LOGGER.log(Level.WARNING, "Failed to save " + getConfigFile(), e);
   }
 }
Exemplo n.º 3
0
  /** Save the settings to a file. */
  public synchronized void save() throws IOException {
    if (BulkChange.contains(this)) return;

    long start = 0;
    if (logger.isLoggable(Level.FINE)) start = System.currentTimeMillis();

    File file = getFingerprintFile(md5sum);
    save(file);
    SaveableListener.fireOnChange(this, getConfigFile(file));

    if (logger.isLoggable(Level.FINE))
      logger.fine(
          "Saving fingerprint " + file + " took " + (System.currentTimeMillis() - start) + "ms");
  }
Exemplo n.º 4
0
  /** Persists the queue contents to the disk. */
  public synchronized void save() {
    if (BulkChange.contains(this)) return;

    // write out the tasks on the queue
    ArrayList<Queue.Item> items = new ArrayList<Queue.Item>();
    for (Item item : getItems()) {
      if (item.task instanceof TransientTask) continue;
      items.add(item);
    }

    try {
      new XmlFile(XSTREAM, getXMLQueueFile()).write(items);
    } catch (IOException e) {
      LOGGER.log(Level.WARNING, "Failed to write out the queue file " + getQueueFile(), e);
    }
  }
Exemplo n.º 5
0
 /** Save the settings to a file. */
 public synchronized void save() throws IOException {
   if (BulkChange.contains(this)) return;
   getConfigFile().write(this);
   SaveableListener.fireOnChange(this, getConfigFile());
 }