diff options
Diffstat (limited to 'ws2015/eip/blaetter/10/2/Synchronizer.java')
-rw-r--r-- | ws2015/eip/blaetter/10/2/Synchronizer.java | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/ws2015/eip/blaetter/10/2/Synchronizer.java b/ws2015/eip/blaetter/10/2/Synchronizer.java new file mode 100644 index 0000000..5efb127 --- /dev/null +++ b/ws2015/eip/blaetter/10/2/Synchronizer.java | |||
@@ -0,0 +1,22 @@ | |||
1 | public class Synchronizer { | ||
2 | public final String targetHash; | ||
3 | private Long solution = null; | ||
4 | |||
5 | public Synchronizer(String hash) { targetHash = hash; } | ||
6 | |||
7 | public synchronized void setSolution(long password) | ||
8 | { | ||
9 | solution = password; | ||
10 | this.notifyAll(); | ||
11 | } | ||
12 | |||
13 | public synchronized long getSolution() | ||
14 | { | ||
15 | return solution; | ||
16 | } | ||
17 | |||
18 | public synchronized boolean hasSolution() | ||
19 | { | ||
20 | return (solution != null); | ||
21 | } | ||
22 | } | ||