}
} } if ((o instanceof TrackDownloader) && !((TrackDownloader)o).isAlive()) { downloadThreads.remove(host);
  private boolean downloadSinglePending() throws IOException {    Track[] tracks = trackDatabase.getTracks();    //keep queued files there    Vector downloadTracks = new Vector();    //download threads keyed by host    Hashtable downloadThreads = new Hashtable();        for (int i = 0; i < tracks.length; i++) {      Track currentTrack = tracks[i];      if (!currentTrack.isHidden()) {        File file = currentTrack.getFile();        if ((file == null || !file.exists()) && currentTrack.getDownloadAttempts() < 10) {          try {            if (file != null) {              currentTrack.unSetFile();              trackDatabase.save();            }            downloadTracks.add(currentTrack);            //gcj doesnt like nulls in hashtables..so we later will replace the value with a thread            downloadThreads.put(currentTrack.getURL().getHost(), currentTrack.getURL().getHost());                      }          catch (IOException e) {            e.printStackTrace();          }        }      }    }        //can't download anything..should contact server    if(downloadTracks.size() == 0)       return false;                while(downloadTracks.size() > 0 || downloadThreads.size() > 0) {      //loop through current threads &queued downloads      Enumeration keyThreads = downloadThreads.keys();      while (keyThreads.hasMoreElements()) {        String host = (String)keyThreads.nextElement();        Object  o = downloadThreads.get(host);        TrackDownloader td;        //if a slot is empty start a new download        if(!(o instanceof TrackDownloader) || !(td=(TrackDownloader)o).isAlive()) {          for (Iterator iter = downloadTracks.iterator(); iter.hasNext(); ) {            Track track = (Track) iter.next();            if(!host.equals(track.getURL().getHost()))              continue;            iter.remove();            System.out.println("Simultaniously downloading url "+track.getURL() + " hidden="+track.isHidden());            td = new TrackDownloader(this, track);            //place a new download in the slot            //silly gcj craps out if we call start fromt the TrackDownloader constructor            td.start();            downloadThreads.put(host, td);          }                  }      }//while      //dont bother the system much      try {        Thread.sleep(1000);      } catch (InterruptedException e) {        e.printStackTrace();      }    }//while        return true;  }