summaryrefslogtreecommitdiff
path: root/ws2015/eip/blaetter/10/2/Synchronizer.java
blob: 5efb127d7fc2f976c0b623457afef96f27702f84 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
public class Synchronizer {
    public final String targetHash;
    private Long solution = null;

    public Synchronizer(String hash) { targetHash = hash; }

    public synchronized void setSolution(long password)
    {
	solution = password;
	this.notifyAll();
    }

    public synchronized long getSolution()
    {
	return solution;
    }

    public synchronized boolean hasSolution()
    {
	return (solution != null);
    }
}