--- android/TrainInfoService/src/dk/thoerup/traininfoservice/banedk/TimetableFetcher.java 2009/10/02 17:18:31 389 +++ android/TrainInfoService/src/dk/thoerup/traininfoservice/banedk/TimetableFetcher.java 2009/10/20 10:32:19 451 @@ -5,6 +5,7 @@ import java.net.URL; import java.util.ArrayList; import java.util.List; +import java.util.Map; import java.util.logging.Logger; import com.gargoylesoftware.htmlunit.Page; @@ -14,6 +15,9 @@ import com.gargoylesoftware.htmlunit.html.HtmlElement; import com.gargoylesoftware.htmlunit.html.HtmlPage; +import dk.thoerup.curcuitbreaker.CircuitBreaker; +import dk.thoerup.curcuitbreaker.CircuitBreakerManager; + public class TimetableFetcher { class NullRefreshHandler implements RefreshHandler { @@ -22,7 +26,7 @@ } - TimeoutCache> cache = new TimeoutCache>(120 * 1000); + Map> cache = new TimeoutMap>(120 * 1000); Logger logger = Logger.getLogger(TimetableFetcher.class.getName()); @@ -54,8 +58,11 @@ webClient.setCssEnabled(false); - final HtmlPage page = webClient.getPage(url); + BanedkInvocation wrapper = new BanedkInvocation(webClient, url); + CircuitBreaker breaker = CircuitBreakerManager.getManager().getCircuitBreaker("banedk"); + HtmlPage page = (HtmlPage) breaker.invoke(wrapper); + boolean currentStation = false; boolean currentStationSaved = false;