01: package dalma.impl;
02:
03: import dalma.Condition;
04: import dalma.Fiber;
05:
06: /**
07: * {@link Condition} that waits for the completion of a {@link Fiber}.
08: *
09: * @author Kohsuke Kawaguchi
10: */
11: final class FiberCompletionCondition extends Condition<Fiber> {
12:
13: /**
14: * The {@link Fiber} whose completion we are blocking.
15: */
16: private final FiberImpl target;
17:
18: FiberCompletionCondition(FiberImpl target) {
19: this .target = target;
20: }
21:
22: public void onParked() {
23: target.getWaitList().add(this );
24: }
25:
26: public void interrupt() {
27: target.getWaitList().remove(this );
28: }
29:
30: public void onLoad() {
31: onParked();
32: }
33:
34: private static final long serialVersionUID = 1L;
35: }
|