@Test public void testNestedTrampolineWithUnsubscribe() { final ArrayList<String> workDone = new ArrayList<String>(); final CompositeSubscription workers = new CompositeSubscription(); Worker worker = Schedulers.trampoline().createWorker(); try { workers.add(worker); worker.schedule(new Action0() { @Override public void call() { workers.add(doWorkOnNewTrampoline("A", workDone)); } }); final Worker worker2 = Schedulers.trampoline().createWorker(); workers.add(worker2); worker2.schedule(new Action0() { @Override public void call() { workers.add(doWorkOnNewTrampoline("B", workDone)); worker2.unsubscribe(); } }); assertEquals(6, workDone.size()); assertEquals(Arrays.asList("A.1", "A.B.1", "A.B.2", "B.1", "B.B.1", "B.B.2"), workDone); } finally { workers.unsubscribe(); } }
@Override public Worker createWorker() { return new InnerCurrentThreadScheduler(); }
TrampolineScheduler extends Scheduler { @Override public Worker createWorker() { return new InnerCurrentThreadScheduler(); } }
TrampolineScheduler extends Scheduler { @Override public Worker createWorker() { return new InnerCurrentThreadScheduler(); } TrampolineScheduler(); }
TrampolineScheduler extends Scheduler { @Override public Worker createWorker() { return new InnerCurrentThreadScheduler(); } TrampolineScheduler(); @Override Worker createWorker(); }
TrampolineScheduler extends Scheduler { @Override public Worker createWorker() { return new InnerCurrentThreadScheduler(); } TrampolineScheduler(); @Override Worker createWorker();  }