/[projects]/dao/FuldDaekningWorker/src/dk/daoas/fulddaekning/LookupMain.java
ViewVC logotype

Diff of /dao/FuldDaekningWorker/src/dk/daoas/fulddaekning/LookupMain.java

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

revision 2258 by torben, Wed Dec 10 10:06:32 2014 UTC revision 2259 by torben, Mon Feb 9 13:21:39 2015 UTC
# Line 6  import java.util.List; Line 6  import java.util.List;
6  import java.util.logging.FileHandler;  import java.util.logging.FileHandler;
7  import java.util.logging.Logger;  import java.util.logging.Logger;
8  import java.util.logging.SimpleFormatter;  import java.util.logging.SimpleFormatter;
9    import java.util.concurrent.*;
10    
11  public class LookupMain {  public class LookupMain {
12    
# Line 29  public class LookupMain { Line 30  public class LookupMain {
30          static Statistik stoersteDataset = new Statistik();          static Statistik stoersteDataset = new Statistik();
31                    
32          static Adresse[] alleDaekkedeAdresser;          static Adresse[] alleDaekkedeAdresser;
33    
34            static ThreadPoolExecutor threadPool;
35    
36            private static void setupThreadPool() {
37                    threadPool = (ThreadPoolExecutor) Executors.newFixedThreadPool(max_workers, new ThreadFactory() {
38                            @Override
39                            public Thread newThread(Runnable r) {
40                                    return new Thread(r, "lookupWorker");
41                            }      
42                    });
43            }
44                    
45                    
46          public static void main(String[] args) throws Exception {          public static void main(String[] args) throws Exception {
# Line 61  public class LookupMain { Line 73  public class LookupMain {
73                                                    
74                  }                  }
75                  logger.info("Starting with MAX_WORKERS:" + max_workers);                  logger.info("Starting with MAX_WORKERS:" + max_workers);
76                    setupThreadPool();
77                                    
78                                    
79                  verbose = Boolean.parseBoolean( conf.getSafeProperty("VERBOSE") );                  verbose = Boolean.parseBoolean( conf.getSafeProperty("VERBOSE") );
# Line 109  public class LookupMain { Line 122  public class LookupMain {
122                          db.resetResultTable();                          db.resetResultTable();
123                                                    
124                          for(String postnr : postnumre) {                          for(String postnr : postnumre) {
125                                  Lookup lookup = new Lookup(postnr, db);                                  Lookup lookup = new Lookup(postnr, db, threadPool);
126                                  lookup.doLookup();                                                        lookup.doLookup();                      
127                          }                          }
128                                                    
# Line 130  public class LookupMain { Line 143  public class LookupMain {
143                                  logger.info( "AlleDaekkedeAdresser.length=" + alleDaekkedeAdresser.length);                                  logger.info( "AlleDaekkedeAdresser.length=" + alleDaekkedeAdresser.length);
144                          }                          }
145                                                    
146                          Lookup lookup = new Lookup("458x", db);                          Lookup lookup = new Lookup("458x", db, threadPool);
147                          lookup.doLookup();                                                                                        lookup.doLookup();                                                              
148                  }                  }
149                                    

Legend:
Removed from v.2258  
changed lines
  Added in v.2259

  ViewVC Help
Powered by ViewVC 1.1.20