--- dao/FuldDaekningWorker/src/dk/daoas/fulddaekning/LookupWorker.java 2015/01/12 09:21:35 2256 +++ dao/FuldDaekningWorker/src/dk/daoas/fulddaekning/LookupWorker.java 2015/02/10 16:27:15 2263 @@ -2,6 +2,8 @@ import java.sql.SQLException; import java.util.Queue; +import java.util.concurrent.BrokenBarrierException; +import java.util.concurrent.CyclicBarrier; import java.util.logging.Level; import java.util.logging.Logger; @@ -17,10 +19,12 @@ int workerId; Lookup lookup; + CyclicBarrier barrier; - public LookupWorker(int workerId, Lookup lookup) { + public LookupWorker(int workerId, Lookup lookup, CyclicBarrier barrier) { this.workerId = workerId; this.lookup = lookup; + this.barrier = barrier; consts = Constants.getInstance(); } @@ -69,13 +73,18 @@ logger.fine("(" +workerId + ") For stor afstand " + qAdresse + " -> " + result.bedsteAfstand); } } else { - logger.warning("(" +workerId + ") Ingen match til " + qAdresse); + logger.fine("(" +workerId + ") Ingen match til " + qAdresse); } } - - - lookup.shutdownWorker( workerId); + try { + barrier.await(); + } catch (BrokenBarrierException e) { + logger.log(Level.SEVERE, e.getMessage(), e); + System.exit(-1); + } catch(InterruptedException e) { + //Do nothing + } } LookupResult findBedsteAdresse(Adresse qAdresse, Adresse daekkede[]) {