updateDir.mkdirs();
}
Set set = namesByTimer.keySet();
for (Iterator iter = set.iterator(); iter.hasNext();) {
final UpdateTimer timer = (UpdateTimer) iter.next();
List list = (List) namesByTimer.get(timer);
Collections.sort(list, TimerHelper.createFileNameComparator(timer));
LOGGER.info("Threading update for timer : " + timer.getFilePrefix() + " : " + list.size() + " files concerned.");
for (Iterator iterator = list.iterator(); iterator.hasNext();) {
final String name = (String) iterator.next();
Thread th = new Thread(new Runnable() {
public void run() {
try {
FTPClient client = getFtpClient();
File zip = new File(getFileContentService().getBaseDir() + "/" + UPDATE_ZIP_DIRECTORY + "/" + name);
zip.createNewFile();
FileOutputStream fos = new FileOutputStream(zip);
client.retrieveFile(name, fos);
fos.close();
closeFtpClient(client);
unThreadedUpdate(zip);
LOGGER.info("Update complete - file : " + name + " - for timer : " + timer.getFilePrefix());
} catch (IOException e) {
LOGGER.error("Problem occured while updating from zip file.", e);
}
};
});
th.start();
}
timer.setLastDone((String) list.get(list.size()-1));
}
LOGGER.info("Updating timer info");
updateUpdateTimers((UpdateTimer[]) namesByTimer.keySet().toArray(new UpdateTimer[namesByTimer.keySet().size()]));
}