public void load ( ) throws IOException { final File nodesDir = getNodesDir ( ) ; final File [ ] subdirs = nodesDir . listFiles ( new FileFilter ( ) { public boolean accept ( File child ) { return child . isDirectory ( ) ; } } ) ; final Map < String , Node > newNodes = new TreeMap <> ( ) ; if ( subdirs != null ) { for ( File subdir : subdirs ) { try { XmlFile xmlFile = new XmlFile ( Jenkins . XSTREAM , new File ( subdir , "config.xml" ) ) ; if ( xmlFile . exists ( ) ) { Node node = ( Node ) xmlFile . read ( ) ; newNodes . put ( node . getNodeName ( ) , node ) ; } } catch ( IOException e ) { Logger . getLogger ( Nodes . class . getName ( ) ) . log ( Level . WARNING , "could not load " + subdir , e ) ; } } } Queue . withLock ( new Runnable ( ) { @ Override public void run ( ) { nodes . entrySet ( ) . removeIf ( stringNodeEntry -> ! ( stringNodeEntry . getValue ( ) instanceof EphemeralNode ) ) ; nodes . putAll ( newNodes ) ; jenkins . updateComputerList ( ) ; jenkins . trimLabels ( ) ; } } ) ; }
Loads the nodes from disk .