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

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

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

revision 2256 by torben, Mon Jan 12 09:21:35 2015 UTC revision 2263 by torben, Tue Feb 10 16:27:15 2015 UTC
# Line 2  package dk.daoas.fulddaekning; Line 2  package dk.daoas.fulddaekning;
2    
3  import java.sql.SQLException;  import java.sql.SQLException;
4  import java.util.Queue;  import java.util.Queue;
5    import java.util.concurrent.BrokenBarrierException;
6    import java.util.concurrent.CyclicBarrier;
7  import java.util.logging.Level;  import java.util.logging.Level;
8  import java.util.logging.Logger;  import java.util.logging.Logger;
9    
# Line 17  public class LookupWorker implements Run Line 19  public class LookupWorker implements Run
19                    
20          int workerId;          int workerId;
21          Lookup lookup;          Lookup lookup;
22            CyclicBarrier barrier;
23                    
24          public LookupWorker(int workerId, Lookup lookup) {          public LookupWorker(int workerId, Lookup lookup, CyclicBarrier barrier) {
25                  this.workerId = workerId;                  this.workerId = workerId;
26                  this.lookup = lookup;                  this.lookup = lookup;
27                    this.barrier = barrier;
28                                    
29                  consts = Constants.getInstance();                  consts = Constants.getInstance();
30          }          }
# Line 69  public class LookupWorker implements Run Line 73  public class LookupWorker implements Run
73                                          logger.fine("(" +workerId + ") For stor afstand " + qAdresse + " -> " + result.bedsteAfstand);                                          logger.fine("(" +workerId + ") For stor afstand " + qAdresse + " -> " + result.bedsteAfstand);
74                                  }                                  }
75                          } else {                          } else {
76                                  logger.warning("(" +workerId + ") Ingen match til " + qAdresse);                                  logger.fine("(" +workerId + ") Ingen match til " + qAdresse);
77                          }                          }
78    
79                  }                  }
80                                    try {
81                                            barrier.await();
82                  lookup.shutdownWorker( workerId);                  } catch (BrokenBarrierException e) {
83                            logger.log(Level.SEVERE, e.getMessage(), e);
84                            System.exit(-1);
85                    } catch(InterruptedException e) {
86                            //Do nothing
87                    }
88          }          }
89                    
90          LookupResult findBedsteAdresse(Adresse qAdresse, Adresse daekkede[]) {          LookupResult findBedsteAdresse(Adresse qAdresse, Adresse daekkede[]) {

Legend:
Removed from v.2256  
changed lines
  Added in v.2263

  ViewVC Help
Powered by ViewVC 1.1.20