static void downloadFile(final String url) throws IOException {

		synchronized (downloadedUrls) {
			if (downloadedUrls.contains(url)) {
				SparkUtils.getLogger().info("url already downloaded:" + url);
				return;
			} else {
				downloadedUrls.add(url);
				synchronized (downloadedUrlWriter) {
					downloadedUrlWriter.write(url);
					downloadedUrlWriter.write("\n");
				}
			}
		}

		EXECUTOR_SERVICE.execute(new Runnable() {

			@Override
			public void run() {
				try {
					HttpService httpService = new HttpService();
					String[] ems = url.split("/");
					String saveUrl = GutenbergCrawler.GUTENBERG_ZIP_DIR
							+ ems[ems.length - 1];
					httpService.downloadFile(url, saveUrl);
					// SparkUtils.unzipFile(saveUrl,
					// GutenbergCrawler.GUTENBERG_TXT_DIR);
				} catch (IOException e) {
					try {
						synchronized (failedUrls) {
							failedUrls.add(url);
							synchronized (failedUrlWriter) {
								failedUrlWriter.write(url);
								failedUrlWriter.write("\n");
							}
						}
					} catch (IOException e1) {
						// TODO Auto-generated catch block
						e1.printStackTrace();
					}
				}
			}
		});
	}