class DownloadMonitor {
	
	private static Log log = LogFactory.getLog(DownloadMonitor.class);
	
	private static Map<String, DownloadStatistics> statistics = new ConcurrentHashMap<String, DownloadStatistics>();
	
	//不公平重入锁,用来控制host的创建
	private static Lock lock = new ReentrantLock();
	
	public static Set<String> getHosts() {
		return statistics.keySet();
	}
	
	public static Map<String, DownloadStatistics> getStatistics() {
		return statistics;
	}
	
	/**
	 * 双重检查机制锁
	 * 
	 * @param host host
	 * @return DownloadStatistics
	 */
	public static DownloadStatistics getStatistics(String host) {<FILL_FUNCTION_BODY>}
	
	private static String getHost(String url) {
		try {
			URL requestUrl = new URL(url);
			String host = requestUrl.getHost();
			return host;
		} catch (MalformedURLException e) {
			log.error(e);
			return url;
		}
	}
	
	public static void incrSuccess(String url) {
		getStatistics(getHost(url)).incrSuccess();
	}
	
	public static void incrServerError(String url) {
		getStatistics(getHost(url)).incrServerError();
	}
	
	public static void incrException(String url) {
		getStatistics(getHost(url)).incrException();
	}
}

		DownloadStatistics downloadStatistics = statistics.get(host);
		if(downloadStatistics != null) {
			return downloadStatistics;
		}
		lock.lock();
		try{
			downloadStatistics = statistics.get(host);
			if(downloadStatistics == null) {
				downloadStatistics = new DownloadStatistics();
				statistics.put(host, downloadStatistics);
			}
		} finally {
			lock.unlock();
		}
		return downloadStatistics;
	
<no_super_class>