@Test public void failUrlTest() throws Exception { UrlBalancer.getInstance().initialize(FAILED_SITE_EXPIRY, URL_LIST); checkList.clear(); checkList.addAll(URL_LIST); PEUrl failedUrl = UrlBalancer.getInstance().getUrl(); UrlBalancer.getInstance().failUrl(failedUrl); checkList.remove(failedUrl.getURL()); int i = 1; while ( !checkList.isEmpty() ) { assertFalse(failedUrl.equals(UrlBalancer.getInstance().getUrl())); checkList.remove(UrlBalancer.getInstance().getUrl().getURL()); i++; assertTrue(i<100); } UrlBalancer.getInstance().close(); }
public void failUrl(PEUrl urlToFail) throws PEException { if ( !managedUrlList.contains(urlToFail) ) throw new PEException("The URL marked to fail isn't in the managed list (" + urlToFail + ")"); failedUrlCache.put(urlToFail.toString(), urlToFail); if ( logger.isDebugEnabled() ) logger.debug("URL Balancer is tracking '" + urlToFail + "' as failed"); }
UrlBalancer { public void failUrl(PEUrl urlToFail) throws PEException { if ( !managedUrlList.contains(urlToFail) ) throw new PEException("The URL marked to fail isn't in the managed list (" + urlToFail + ")"); failedUrlCache.put(urlToFail.toString(), urlToFail); if ( logger.isDebugEnabled() ) logger.debug("URL Balancer is tracking '" + urlToFail + "' as failed"); } }
UrlBalancer { public void failUrl(PEUrl urlToFail) throws PEException { if ( !managedUrlList.contains(urlToFail) ) throw new PEException("The URL marked to fail isn't in the managed list (" + urlToFail + ")"); failedUrlCache.put(urlToFail.toString(), urlToFail); if ( logger.isDebugEnabled() ) logger.debug("URL Balancer is tracking '" + urlToFail + "' as failed"); } private  UrlBalancer(); }
UrlBalancer { public void failUrl(PEUrl urlToFail) throws PEException { if ( !managedUrlList.contains(urlToFail) ) throw new PEException("The URL marked to fail isn't in the managed list (" + urlToFail + ")"); failedUrlCache.put(urlToFail.toString(), urlToFail); if ( logger.isDebugEnabled() ) logger.debug("URL Balancer is tracking '" + urlToFail + "' as failed"); } private  UrlBalancer(); void initialize(int failedUrlExpiration, List<String> providedUrlList); void close(); PEUrl getUrl(); int size(); void failUrl(PEUrl urlToFail); static UrlBalancer getInstance(); }
UrlBalancer { public void failUrl(PEUrl urlToFail) throws PEException { if ( !managedUrlList.contains(urlToFail) ) throw new PEException("The URL marked to fail isn't in the managed list (" + urlToFail + ")"); failedUrlCache.put(urlToFail.toString(), urlToFail); if ( logger.isDebugEnabled() ) logger.debug("URL Balancer is tracking '" + urlToFail + "' as failed"); } private  UrlBalancer(); void initialize(int failedUrlExpiration, List<String> providedUrlList); void close(); PEUrl getUrl(); int size(); void failUrl(PEUrl urlToFail); static UrlBalancer getInstance();  }