@Test(timeout = 3000) public void testNoSelfInterrupt() throws InterruptedException { Scheduler.Worker worker = Schedulers.newThread().createWorker(); try { final CountDownLatch run = new CountDownLatch(1); final CountDownLatch done = new CountDownLatch(1); final AtomicReference<Throwable> exception = new AtomicReference<Throwable>(); final AtomicBoolean interruptFlag = new AtomicBoolean(); ScheduledAction sa = (ScheduledAction)worker.schedule(new Action0() { @Override public void call() { try { run.await(); } catch (InterruptedException ex) { exception.set(ex); } } }); sa.add(Subscriptions.create(new Action0() { @Override public void call() { interruptFlag.set(Thread.currentThread().isInterrupted()); done.countDown(); } })); run.countDown(); done.await(); Assert.assertEquals(null, exception.get()); Assert.assertFalse("Interrupted?!", interruptFlag.get()); } finally { worker.unsubscribe(); } }
@Override public Worker createWorker() { return new NewThreadWorker(THREAD_FACTORY); }
NewThreadScheduler extends Scheduler { @Override public Worker createWorker() { return new NewThreadWorker(THREAD_FACTORY); } }
NewThreadScheduler extends Scheduler { @Override public Worker createWorker() { return new NewThreadWorker(THREAD_FACTORY); } private  NewThreadScheduler(); }
NewThreadScheduler extends Scheduler { @Override public Worker createWorker() { return new NewThreadWorker(THREAD_FACTORY); } private  NewThreadScheduler(); @Override Worker createWorker(); }
NewThreadScheduler extends Scheduler { @Override public Worker createWorker() { return new NewThreadWorker(THREAD_FACTORY); } private  NewThreadScheduler(); @Override Worker createWorker();  }