Code example for HashSet

Methods: add

0
public class BetterHttpRequestRetryHandler implements HttpRequestRetryHandler {
 
	// TODO: make configurable 
	private static final int RETRY_SLEEP_TIME_MILLIS = 1500;
 
	private static HashSet<Class<?>> exceptionWhitelist = new HashSet<Class<?>>();
 
	private static HashSet<Class<?>> exceptionBlacklist = new HashSet<Class<?>>();
 
	static { 
		// Retry if the server dropped connection on us 
		exceptionWhitelist.add(NoHttpResponseException.class);
		// retry-this, since it may happens as part of a Wi-Fi to 3G failover 
		exceptionWhitelist.add(UnknownHostException.class);
		// retry-this, since it may happens as part of a Wi-Fi to 3G failover 
		exceptionWhitelist.add(SocketException.class);
 
		// never retry timeouts 
		// TODO: this doesn't actually capture all timeouts; I've seen timeouts 
		// being thrown as a 
		// plain SocketExceptiion