/[projects]/dao/DaoAdresseService/src/main/java/dk/daoas/daoadresseservice/OSMStreetnameHelper.java
ViewVC logotype

Diff of /dao/DaoAdresseService/src/main/java/dk/daoas/daoadresseservice/OSMStreetnameHelper.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2566 by torben, Thu Jun 4 19:29:39 2015 UTC revision 2567 by torben, Sun Jun 7 18:09:16 2015 UTC
# Line 32  public class OSMStreetnameHelper impleme Line 32  public class OSMStreetnameHelper impleme
32                  if (conf.useOpenStreetMaps == false)                  if (conf.useOpenStreetMaps == false)
33                          return null;                          return null;
34                                    
                 limiter.acquire();  
35    
36                  result.osm = true;                  result.osm = true;
37                                    
38                  try {                  try {
39    
40                          OSMInvocation wrapper = new OSMInvocation( conf, request.postnr, request.vejnavn );                          OSMInvocation wrapper = new OSMInvocation( limiter, conf, request.postnr, request.vejnavn );
41                          CircuitBreaker breaker = CircuitBreakerManager.getManager().getCircuitBreaker("osm");                          CircuitBreaker breaker = CircuitBreakerManager.getManager().getCircuitBreaker("osm");
42    
43                          result.osmVej = (String) breaker.invoke(wrapper);                          result.osmVej = (String) breaker.invoke(wrapper);
# Line 54  public class OSMStreetnameHelper impleme Line 53  public class OSMStreetnameHelper impleme
53                  int postnr;                  int postnr;
54                  String vejnavn;                  String vejnavn;
55                  ServiceConfig conf;                  ServiceConfig conf;
56                    RateLimiter limiter;
57                                    
58                  public OSMInvocation(ServiceConfig conf, int postnr, String vejnavn) {                  public OSMInvocation(RateLimiter limiter, ServiceConfig conf, int postnr, String vejnavn) {
59                            this.limiter = limiter;
60                          this.conf = conf;                          this.conf = conf;
61                          this.postnr= postnr;                          this.postnr= postnr;
62                          this.vejnavn = vejnavn;                                          this.vejnavn = vejnavn;                
# Line 63  public class OSMStreetnameHelper impleme Line 64  public class OSMStreetnameHelper impleme
64                                    
65                  @Override                  @Override
66                  public String proceed() throws Exception {                  public String proceed() throws Exception {
67                            limiter.acquire();
68    
69    
70                          //TimingHelper timer = new TimingHelper();                          //TimingHelper timer = new TimingHelper();
71                          String encVej = URLEncoder.encode(vejnavn, "UTF-8");                          String encVej = URLEncoder.encode(vejnavn, "UTF-8");
72                                                    

Legend:
Removed from v.2566  
changed lines
  Added in v.2567

  ViewVC Help
Powered by ViewVC 1.1.20