| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| Latch |
|
| 0.0;0 |
| 1 | package org.webslinger.util; | |
| 2 | ||
| 3 | import java.util.concurrent.Callable; | |
| 4 | ||
| 5 | public final class Latch { | |
| 6 | private int count; | |
| 7 | private final Callable<?> onDone; | |
| 8 | ||
| 9 | 0 | public Latch(int count, Callable<?> onDone) { |
| 10 | 0 | this.count = count; |
| 11 | 0 | this.onDone = onDone; |
| 12 | 0 | } |
| 13 | ||
| 14 | public synchronized void pulse() throws Exception { | |
| 15 | 0 | count--; |
| 16 | 0 | if (count == 0) onDone.call(); |
| 17 | 0 | } |
| 18 | } |