--- dao/DaoAdresseService/src/main/java/dk/daoas/daoadresseservice/GoogleStreetnameHelper.java 2015/06/04 19:29:39 2566 +++ dao/DaoAdresseService/src/main/java/dk/daoas/daoadresseservice/GoogleStreetnameHelper.java 2015/06/07 18:09:16 2567 @@ -35,12 +35,11 @@ if (conf.useGoogle == false) return null; - limiter.acquire(); result.google = true; try { - GoogleInvocation wrapper = new GoogleInvocation( conf, request.postnr, request.vejnavn ); + GoogleInvocation wrapper = new GoogleInvocation( limiter, conf, request.postnr, request.vejnavn ); CircuitBreaker breaker = CircuitBreakerManager.getManager().getCircuitBreaker("google"); @@ -58,8 +57,10 @@ ServiceConfig conf; int postnr; String vejnavn; + RateLimiter limiter; - public GoogleInvocation(ServiceConfig conf, int postnr, String vejnavn) { + public GoogleInvocation(RateLimiter limiter, ServiceConfig conf, int postnr, String vejnavn) { + this.limiter = limiter; this.conf = conf; this.postnr= postnr; this.vejnavn = vejnavn; @@ -68,6 +69,8 @@ @Override public String proceed() throws Exception { + + limiter.acquire(); final Geocoder geocoder; if ( conf.googleApiKey != null ) {