/[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 2259 by torben, Mon Feb 9 13:21:39 2015 UTC revision 2260 by torben, Mon Feb 9 14:00:53 2015 UTC
# Line 34  public class LookupMain { Line 34  public class LookupMain {
34          static ThreadPoolExecutor threadPool;          static ThreadPoolExecutor threadPool;
35    
36          private static void setupThreadPool() {          private static void setupThreadPool() {
37                  threadPool = (ThreadPoolExecutor) Executors.newFixedThreadPool(max_workers, new ThreadFactory() {                  threadPool = (ThreadPoolExecutor) Executors.newFixedThreadPool(max_workers, new WorkerThreadFactory() );
                         @Override  
                         public Thread newThread(Runnable r) {  
                                 return new Thread(r, "lookupWorker");  
                         }        
                 });  
38          }          }
39                    
40                    
# Line 146  public class LookupMain { Line 141  public class LookupMain {
141                          Lookup lookup = new Lookup("458x", db, threadPool);                          Lookup lookup = new Lookup("458x", db, threadPool);
142                          lookup.doLookup();                                                                                        lookup.doLookup();                                                              
143                  }                  }
144    
145                    threadPool.shutdown();
146                                    
147                  long now = System.currentTimeMillis();                  long now = System.currentTimeMillis();
148                  long elapsed = now - start ;                  long elapsed = now - start ;
# Line 182  public class LookupMain { Line 179  public class LookupMain {
179                  int hours   = (int) ((milliseconds / (1000*60*60)) % 24);                  int hours   = (int) ((milliseconds / (1000*60*60)) % 24);
180                                    
181                  return String.format("%02d:%02d:%02d.%03d", hours, minutes, seconds, mseconds);                  return String.format("%02d:%02d:%02d.%03d", hours, minutes, seconds, mseconds);
182          }                }
183            
184            static class WorkerThreadFactory implements ThreadFactory {
185                    int count = 0;
186    
187                    @Override
188                    public Thread newThread(Runnable r) {
189                            return new Thread(r, "lookupWorker/" + count++);
190                    }      
191            }
192  }  }

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

  ViewVC Help
Powered by ViewVC 1.1.20