package pulley;

public final class Schedulers {

    private static final Scheduler TRAMPOLINE = new SchedulerTrampoline();
    private static final Scheduler IMMEDIATE = new SchedulerImmediate();
    private static final Scheduler COMPUTATION = new SchedulerComputation();

    public static Scheduler trampoline() {
        return TRAMPOLINE;
    }

    public static Scheduler immediate() {
        return IMMEDIATE;
    }

    public static Scheduler computation() {
        return COMPUTATION;
    }
}

@@ -10,16 +10,167 @@
 ulley;%0A%0A
+import java.util.concurrent.CountDownLatch;%0Aimport java.util.concurrent.atomic.AtomicReference;%0A%0Aimport pulley.actions.A0;%0Aimport pulley.functions.F;%0A%0A
 public f
@@ -649,11 +649,619 @@
 N;%0A    %7D
+%0A%0A    public static %3CT%3E Result%3CT%3E getAndJoin(final Promise%3CT%3E promise) %7B%0A        final AtomicReference%3CResult%3CT%3E%3E ref = new AtomicReference%3CResult%3CT%3E%3E();%0A        final CountDownLatch latch = new CountDownLatch(1);%0A        promise.scheduler().schedule(new A0() %7B%0A%0A            @Override%0A            public void call() %7B%0A                ref.set(Promises.result(promise).get());%0A                latch.countDown();%0A            %7D%0A        %7D);%0A        try %7B%0A            latch.await();%0A            return ref.get();%0A        %7D catch (InterruptedException e) %7B%0A            throw new RuntimeException(e);%0A        %7D%0A    %7D
 %0A%7D%0A

add scheduler