-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFletteTrad.java
More file actions
46 lines (31 loc) · 1.17 KB
/
FletteTrad.java
File metadata and controls
46 lines (31 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import java.util.concurrent.CountDownLatch;
import java.util.HashMap;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
public class FletteTrad implements Runnable {
Monitor2 monitor;
CountDownLatch latch;
Lock laas = new ReentrantLock();
FletteTrad(Monitor2 monitor, CountDownLatch latch){
this.monitor = monitor;
this.latch = latch;
}
public void run(){
laas.lock();
try {
HashMap<String, Subsekvens> totalHash = new HashMap<String, Subsekvens>();
if(monitor.subsekvensRegister.RegisterStoerrelse() == 1){
return;
}
for(HashMap<String, Subsekvens> hashMap: monitor.subsekvensRegister.lokaltRegister){
totalHash = monitor.subsekvensRegister.SlaaSammenHashMap(hashMap, totalHash);
}
monitor.subsekvensRegister.lokaltRegister.clear();
monitor.SettInnHashMap(totalHash);
} catch (Exception e) {
e.printStackTrace();
} finally{
latch.countDown();
}
}
}