/[projects]/dao/DaoAdresseVedligehold/src/main/java/dk/daoas/adressevedligehold/afstandandenrute/AfstandAndenRuteTask.java
ViewVC logotype

Diff of /dao/DaoAdresseVedligehold/src/main/java/dk/daoas/adressevedligehold/afstandandenrute/AfstandAndenRuteTask.java

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

revision 2908 by torben, Wed Feb 3 21:31:51 2016 UTC revision 2946 by torben, Sat Feb 13 13:16:34 2016 UTC
# Line 41  public class AfstandAndenRuteTask extend Line 41  public class AfstandAndenRuteTask extend
41    
42          ThreadPoolExecutor threadPool;          ThreadPoolExecutor threadPool;
43    
44            boolean isIncremental;
45    
46    
47          public AfstandAndenRuteTask(String distributor) {          public AfstandAndenRuteTask(String distributor, String type) {
48                  this.distributor = distributor;                  this.distributor = distributor;
49                    
50                    type = type.toUpperCase();
51                    switch(type) {
52                    case "FULL":
53                            isIncremental = false;
54                            break;
55                    case "INCREMENTAL":
56                            isIncremental = true;
57                            break;
58                    default:
59                            throw new RuntimeException("Unknown type" + type);                      
60                    }
61          }          }
62    
63    
64          @Override          @Override
65          protected void taskRun() throws Exception {          protected void taskRun() throws Exception {
66                    
   
   
   
                 //Setup j.u.l Logger  
                 //Logger root = Logger.getLogger("");  
                 //FileHandler fhandler = new FileHandler("fulddaekning.log"); // Ingen max størrelse, ingen rotation og ingen append  
                 //fhandler.setFormatter( new SimpleFormatter() );  
                 //root.addHandler( fhandler );  
   
   
67    
68                  Constants.init(distributor);                  Constants.init(distributor);
69                  Constants consts = Constants.getInstance();                  Constants consts = Constants.getInstance();
# Line 79  public class AfstandAndenRuteTask extend Line 82  public class AfstandAndenRuteTask extend
82                  }                  }
83                  logger.info("Starting with MAX_WORKERS:" + max_workers);                          logger.info("Starting with MAX_WORKERS:" + max_workers);        
84                  setupThreadPool(max_workers);                  setupThreadPool(max_workers);
85                    
86                    logger.info("Starting with INCREMENTAL:" + isIncremental);
87    
88    
89    
90                  try (Connection conn = DBConnection.getConnection() ) {                  try (Connection conn = DBConnection.getConnection() ) {
91                          Database db = new Database(conn);                          DatabaseRouteDistance db = new DatabaseRouteDistance(conn, isIncremental);
92                            
93                            db.prepareIncrementalSearch();
94    
95                          Queue<Address> ikkeDaekkede = db.hentAlleIkkedaekkedeAdresser(consts.getMinPostnr(), consts.getMaxPostnr() );                          Queue<Address> ikkeDaekkede = db.hentAlleIkkedaekkedeAdresser(consts.getMinPostnr(), consts.getMaxPostnr() );
96                          antalIkkeDaekkede = ikkeDaekkede.size();                          antalIkkeDaekkede = ikkeDaekkede.size();
# Line 170  public class AfstandAndenRuteTask extend Line 177  public class AfstandAndenRuteTask extend
177    
178    
179    
180                          } else {                          } /*else {
181                                  /// Test                                  /// Test
182                                  /*                                  
183                                  db.resetResultTable();                                  db.resetResultTable();
184    
185    
# Line 181  public class AfstandAndenRuteTask extend Line 188  public class AfstandAndenRuteTask extend
188    
189                                  short post = (short) 2700;                                                        short post = (short) 2700;                      
190                                  Lookup lookup = new Lookup(post, db, threadPool);                                  Lookup lookup = new Lookup(post, db, threadPool);
191                                  lookup.doLookup();*/                                                                                              lookup.doLookup();                                                              
192                          }                          } */
193    
194    
195                          long now = System.currentTimeMillis();                          long now = System.currentTimeMillis();
# Line 240  public class AfstandAndenRuteTask extend Line 247  public class AfstandAndenRuteTask extend
247    
248          @Override          @Override
249          public String getDetail() {          public String getDetail() {
250                  // TODO Auto-generated method stub                  if (isIncremental) {
251                  return "";                          return "Type: incremental";
252                    } else {
253                            return "Type: full";
254                    }
255          }          }
256    
257    

Legend:
Removed from v.2908  
changed lines
  Added in v.2946

  ViewVC Help
Powered by ViewVC 1.1.20