--- dao/DaoAdresseService/src/main/java/dk/daoas/daoadresseservice/OSMStreetnameHelper.java 2015/06/04 19:29:39 2566 +++ dao/DaoAdresseService/src/main/java/dk/daoas/daoadresseservice/OSMStreetnameHelper.java 2015/06/07 18:09:16 2567 @@ -32,13 +32,12 @@ if (conf.useOpenStreetMaps == false) return null; - limiter.acquire(); result.osm = true; try { - OSMInvocation wrapper = new OSMInvocation( conf, request.postnr, request.vejnavn ); + OSMInvocation wrapper = new OSMInvocation( limiter, conf, request.postnr, request.vejnavn ); CircuitBreaker breaker = CircuitBreakerManager.getManager().getCircuitBreaker("osm"); result.osmVej = (String) breaker.invoke(wrapper); @@ -54,8 +53,10 @@ int postnr; String vejnavn; ServiceConfig conf; + RateLimiter limiter; - public OSMInvocation(ServiceConfig conf, int postnr, String vejnavn) { + public OSMInvocation(RateLimiter limiter, ServiceConfig conf, int postnr, String vejnavn) { + this.limiter = limiter; this.conf = conf; this.postnr= postnr; this.vejnavn = vejnavn; @@ -63,6 +64,9 @@ @Override public String proceed() throws Exception { + limiter.acquire(); + + //TimingHelper timer = new TimingHelper(); String encVej = URLEncoder.encode(vejnavn, "UTF-8");