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 |
|
|
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 |
} |
} |
77 |
} |
} |
78 |
|
|
79 |
} |
} |
80 |
|
try { |
81 |
|
barrier.await(); |
82 |
|
} 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[]) { |